News for hackers. Stuff that matters.
Re:XML is better than YAML by jandrese on Wednesday September 20, 2023 @09:49PM (#37592354)
Also, config files that are also programs are a classic security vulnerability. Fun!
Re:XML is better than YAML by richbell on Wednesday September 20, 2023 @09:51PM (#37592374)
The author of SnakeYaml argued vehemently that a library executing untrusted code by default was a feature that people wanted.

https://bitbucket.org/snakeyaml/snakeyaml/issues/561/cve-202...

Re:XML is better than YAML by lodovic on Thursday September 21, 2023 @01:51AM (#37593690)
wow, what a read. I'm now convinced to immediately remove that library if I ever come across it.
Re:XML is better than YAML by ludwik on Thursday September 21, 2023 @02:35AM (#37593944)
Wow, this is truly terrifying. It reads as if Donald Trump was the maintainer of a popular library. "Low quality tooling! Sad!!!".

He claims with a straight face that every software using his library only loads YAMLs from sources 100% trusted to execute code. He is given example after example to the contrary, which he ignores instead opting to constantly blame "low quality tooling" for generating "false reports" about his perfect software. People can be really weird sometimes.

Re:XML is better than YAML by sheepshear on Thursday September 21, 2023 @05:04AM (#37595062)
A lot of people misunderstand what he's actually saying.

There are two categories of constructors. One is for data that you don't want to execute, the other is for trusted data that you do want to execute.

There are two libraries. One has default constructors that can execute data, the other has default constructors that don't execute data.

He's saying to rtfm and choose the library with the correct defaults, to choose the correct constructor from that library, and to stop trying to take away the choice.

Re:XML is better than YAML by richbell on Thursday September 21, 2023 @08:28AM (#37596615)
> He's saying to rtfm and choose the library with the correct defaults, choose the correct constructor from that library, and stop trying to take away the choice.

Nobody was trying to "take away the choice".

The problem is that you have to explicitly opt-in to be safe. If you followed the code snippets from the README, your application would be vulnerable to RCE without you realizing it; as people pointed out, it would be more secure to have Constructor (safe by default) + DangerousConstructor rather than Constructor (unsafe by default) + SafeConstructor.

His argument was that "100% of applications using SnakeYaml do not accept untrusted data".

Re:XML is better than YAML by sheepshear on Thursday September 21, 2023 @10:31AM (#37598181)
I understood him to be speaking tautologically, that you trust the data when you choose the trusting library without using the safe constructor, whether or not you realize the implication.

As he explained, this library is, by design, convenient by default. Those seeking safe by default should consider the other library.

"take away the choice" is my summary of several comments that would have the feature removed. One was about how its existence is a vulnerability if file access is compromised. Another was about how code execution is not in the spec. And so on.

Re:XML is better than YAML by richbell on Thursday September 21, 2023 @12:05PM (#37599692)
> I understood him to be speaking tautologically, that you trust the data when you choose the trusting library without using the safe constructor, whether or not you realize the implication.

He was speaking literally; he even rejected several of the provided examples because "users have to login first, therefore the data is trusted" which isn't an argument that any security-conscious person would make.

> As he explained, this library is, by design, convenient by default. Those seeking safe by default should consider using the other library.

That is a negligent mindset to have. Log4J added the ability to execute arbitrary dns and ldap calls for the sake of convenience, which resulted in one of the most consequential vulnerabilities of the past decade.

Opt-in security is dangerous and should never be the default — especially when the feature in question is executing arbitrary input.

Re:XML is better than YAML by sheepshear on Thursday September 21, 2023 @03:48PM (#37603216)
He also said to sanitize any data that you intend to use with the unsafe constructors. Taken together, he's pointing out that you decide how much you trust the data and you control which constructor to use. "Problem in chair"

"Should" statements are always relative to what you value. Clearly he thinks this trade-off is fine for him. His other library accommodates your security needs but this one accommodates his convenience needs. Can the man not make something for himself?

I assume it would be costly for him to make and propagate the changes. Maybe money could persuade him.

Re:XML is better than YAML by richbell on Thursday September 21, 2023 @04:10PM (#37603562)
> He also said to sanitize any data that you intend to use with the unsafe constructors. Taken together, he's pointing out that you decide how much you trust the data and you control which constructor to use. "Problem in chair"

That doesn't change the fact that it's a poorly designed API that's insecure by default. There are countless situations where people are inadvertently exposed to risk via transitive dependencies, at no fault of their own.

> Can the man not make something for himself?

He did not make it for himself, he made it to he consumed by others. SnakeYAML is a widely used package.

Re:XML is better than YAML by sheepshear on Thursday September 21, 2023 @06:26PM (#37605285)
He said he designed it for his use case of executing trusted configuration code, which some others appreciate. Obviously there was some misunderstand about the goals and priorities of the project.

Making this change would cost him something he values without giving him something else he values in return. According to him, Snake Engine already provides a default safe solution, so he's not leaving anyone without a remedy. It would cost you to switch, but you would get something in return. That seems fair to me.

Re:XML is better than YAML by sznio on Thursday September 21, 2023 @06:32AM (#37595705)
If you don't trust the data you're supposed to use SafeConstructor.

It's like blaming the browser vendor for an XSS vulnerability rather than the backend implementation not using HtmlEncode.

Re:XML is better than YAML by zkldi on Thursday September 21, 2023 @07:58AM (#37596333)
why isn't the default secure? if the default isn't secure we have learned time and time again that people will use the default unknowingly exposing themselves to security holes.

Here's just a couple examples off the top of my head:

- `$variables` in bash are subject to arbitrary code execution via word splitting without escaping

- PHP register_globals

- PHP, express, and some others parse `?a[b]="foo"` in a query string as an object, allowing for prototype pollution or other exploits

- string concatenation for SQL + escape_string being the default for years

- perl array expansion in function calls

- XML entity inclusion on by default allowing you to read arbitrary files

- log4j executing arbitrary code inside its logs

- passing a variable to printf's first arg

- no difference between escaped and unescaped tags in php

- xargs splitting on whitespace

- yaml allowing arbitrary code execution (it got rails good!)

and there's probably loads more.

Re:XML is better than YAML by legends2k on Wednesday September 20, 2023 @11:09PM (#37592802)
True but that's to be tackled differently instead of not providing scripting at all.
Re:XML is better than YAML by TeMPOraL on Thursday September 21, 2023 @02:59AM (#37594098)
Well, let's be honest: security sucks out all the joy from everything. Even before freedom, the first victim of security is fun.
Re:XML is better than YAML by jandrese on Thursday September 21, 2023 @02:58PM (#37602341)
Otherwise phrased as "this is why we can't have nice things".