-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CVE-2022-25857 - Upgrade to SnakeYAML 1.31 #32221
Comments
Update: we've just pushed a fix for broken timestamp/dates handling with SnakeYaml 1.31 in the upcoming Spring Boot 2.6.x and 2.7.x. We're still defaulting to 1.29 and 1.30 in those versions, but unlocking the possibility to use SnakeYaml 1.31 at runtime; see #32228. |
@nytro77 thanks I've edited my comment. Yes we'll stick to 1.30 in 2.7.x for the same reason. |
@bclozel Ah ok. Just deleted my comment because i thought my eyes tricked me :) |
It is sad, that false positives have such an influence. |
@bclozel Would you include an update to a potential Version 1.30.1 of snakeyaml, that fixes only same bugs in 2.7.x ? My issue is, that I support dozens of projects where this vulnerability popped up. Unfortunately I can't mark it in general as "false positive". Instead I have to check every project, that it doesn't process external yamls. I assume that there a thousands of teams around the world doing the same thing. |
@bclozel what are the bugs ? |
IMO, the root cause of the problem is the CVE database and security scanning throwing up false positives. Trying to convince an open source maintainer to take on an additional maintenance burden due to that doesn't feel right to me. You can use SnakeYAML 1.31 right now with Spring Boot 2.6 and 2.7 with one small caveat. Due to a change in a method that Spring Boot overrides, some custom handling of timestamp-like values is lost. Consider the following YAML: example: 2015-01-28 With SnakeYAML 1.30 and earlier, Spring Boot will successfully customize SnakeYAML so that the value is left as-is. With SnakeYAML 1.31 this customization does not succeed and it is coerced into a example: '2015-01-28' The forthcoming Spring Boot 2.6.x and 2.7.x releases adapt to the changes in SnakeYAML 1.31 so that this quoting isn't necessary (but won't do any harm). |
@wilkinsona can you please provide the method which was changed ? We do our best to keep backwards compatible changes |
I can help to integrate the latest version of SnakeYAML into Spring Boot ! |
@asomov it's not a bug and I wouldn't blame SnakeYaml for breaking backwards compatibility. We're subclassing |
Thanks, @asomov. We use a custom
Thanks very much for the offer. I think we've already managed to do this. Spring Boot 2.6.x and 2.7.x snapshots are fully compatible with SnakeYAML 1.31 (while continuing to use 1.29 and 1.30 respectively by default). Spring Boot 3.0 snapshots have upgraded to SnakeYAML 1.31. |
Thank you. I see how myself and others suffer from the very low quality of CVE (whatever it is). |
By the way, may be Spring Boot can consider the migration to the SnakeYAML Engine which does not have the special treatment of 2022-09-06 value. I am here to support the transition |
If I knew that I may create such an issue for Spring Boot, I would not apply this change. The value of it is negligible, the consequence it awful. |
@asomov you don't need to revert anything, it's all taken care of on our side now and this will be released soon. |
Hi, our team project needs to address cve-upgrade snakeyaml to 1.31. I specify the snakeyaml version in the build.gradle file as below: |
@xuekvm Spring Boot 2.5 is out of OSS support so you'll have to upgrade to a supported version first. We're aware of one problem with |
Hello , after adding this property <snakeyaml.version>1.31</snakeyaml.version> , when showing the effective pom , I saw always the ancient version , the version of spring boot is 2.6.9 Is it normal? Can someone helps me please. |
Spring Boot 2.6.x uses SnakeYAML 1.29 by default so something other than Spring Boot is controlling its version and setting it to 1.30. If you'd like some help with that, please post a question on Stack Overflow and include a pom that reproduces the problem in your question. |
Hi, I am using springboot version 2.7.1 and upgrading snake yml dependency to 1.32 is breaking the code base due to date fields in yml files. could you please suggest what spring boot version we need to upgrade to have these compatibility issue fixed? I don’t find the 2.6.12 version in maven repo. |
@abegum123 this is already fixed and to be shipped with Spring Boot 2.6.12 and 2.7.4, see #32228 Both releases are scheduled next week. |
@npolovnikov The default version of SnakeYAML hasn't change in Spring Boot 2.7. Please read the opening comment in this issue. It describes when you should consider manually overriding the SnakeYAML version and how to do so. |
Dear @asomov , I deeply respect the time you spend for the project snakeyaml. I am also not happy, that every potential DoS gets a CVE score 7+
I am sure you know OSS-Fuzz, which seems to be a source of some of the Snakeyaml 1.30 findings - although not directly visible there
As already pointed out, snakeyaml is responsible for yaml sanitization. Otherwise another yaml-parser would need to be build duplicating half of your work.
Whataboutism
I agree. Unfortunately as long as the Context is not guaranteed, someone could have the idea to use yaml files from users (Example: gitlab-ci) and use snakeyaml to parse those files. That's why those findings are probably still treated as valid.
This was a prediction on the known findings at that point.
I have to clarify this point perhaps: If hypthetically someone was coding a service, that uses yaml formatted user input, there would be the freedom to use any yaml parser. Using snakeyaml 1.30 would be not the best idea, because of the DoS risks.
See again the vulnerability count on mvnrepository.com |
I constantly receive the message that it is complex to check the vulnerability properly. I find it no excuse to substitute low quality with inability. Image you do it for anything else (it is difficult to create concurrent applications, so we just let the application to have low quality and fail in production). I am told "this is the industry state, we do not have anything better". At least everybody should be aware of the very low state to properly ignore the invalid warnings. |
Spring Boot 3.0.5 upgraded it to SnakeYAML 1.33, but there is still a critical VULNERABILITIES in SankeYAML 1.33: CVE-2022-1471, it should upgrade it to SankeYAML 2.0 |
@kendarkfire it is a false positive (as many many others). Spring Boot uses SafeConsturctor. Please read the CVE-2022-1471 |
@asomov |
@kendarkfire what it has to do with Spring Boot ? Why do you report it here ? They can make a mistake with or without Spring. |
Thanks to both @kendarkfire and especially @asomov 💯 for sharing information here. It was helpful for me to grasp faster what is going on with this reported CVE. I'm referencing following issue: #35064. As I understand, if you are in a panic mode you can override the version of snake yaml to version 2.0 without breaking changes for your standard application configuration file (can't confirm didn't tried it yet) |
@rivancic I am sorry, I did not get you. Especially the "panic mode". |
"panic mode" - you want ASAP get rid of the CVE warning from any of the dependency scanning tools. |
@rivancic If you're in "panic mode" about this particular CVE, you're 8 months late as we've released Spring Boot versions that are compatible with 1.31+ for a while now. You can run SnakeYaml 2.0 with compatible Spring Boot versions. |
@rivancic the best thing you can do:
|
Issue #91 This change simply change the required version by spring boot of this dependency. You can learn more about it here: - spring-projects/spring-boot#32221 - https://avd.aquasec.com/nvd/2022/cve-2022-1471/
* feat: add backend initial files Issue #91 This commit adds initial files generated by start.spring.io website where the project was generated with: - Project: Maven - Language: Java - Spring Boot version: 3.1.3 (latest stable) - Project metadata group: ca.bc.gov.restapi - Project metadata artifact: results - Project metadata name: results - Project metadata description: RESULTS REST API - Packaging: Jar - Java version: 17 - Dependencies - Actuator - Data JPA - OAuth2 Authorization server - OAuth2 client - Started web - Devtools - H2 Database - Lombok - GraalVM * feat: add maven wrapper jar Issue #91 Adding the maven wrapper is a good practice, recommended in case you want to use maven out of the box. * feat: add plugins and review pom.xml backend file Issue #91 This change adds required dependencies for building, running and packaging the service locally and for Cloud Native images. This is what was changed: - Add project license - Add properties and definitions - Add profiles for dev, prod and native - Add dependencies - Add plugins for building, running and packaging - Add project final name jar, line 179 * feat: add google checkstyle Issue #91 This commit adds the google checkstyle xml definition file to be used as a guide for the checkings. Also updates existing class files to met the checkstyle validations, replacing tab by spaces, adding JavaDoc to all public classes. * feat: add backend to docker compose file Issue #91 This change adds a new service to the docker-compose file for the backend REST api. If you want to run the backend locally all you need is to run at the project root folder: `docker compose up backend` and you're all set. Other minor changes were made: - Add some properties to the application properties file - Remove dependencies not required for now * test: fix test cases and tests configuration Issue #91 This change gets tests passing and cloud native build working and running smoothly. * docs: update readme file to include new service Issue #91 This change simply add more information on the new service in the back end. * feat: update sb version to 3.1.4 and java to 21 Issue #91 This change updates the Spring Boot version to the latest (at the time of this writing), which is 3.1.4. And also updates the required Java version required to compile and run this service, which is the 21. * feat: update docker compose to run with java 21 Issue #91 This commit updates the existing docker-compose file to use the latest maven with Java 21 available at this moment. * fix: trivy warning cve-2022-1471 Issue #91 This change simply change the required version by spring boot of this dependency. You can learn more about it here: - spring-projects/spring-boot#32221 - https://avd.aquasec.com/nvd/2022/cve-2022-1471/
CVE-2022-25857 has been reported against the SnakeYaml project. This issue upgrades SnakeYaml to 1.31 for Spring Boot 3.0.0.
This CVE can make applications vulnerable to DoS attacks, given the Yaml parser is used to parse untrusted input. Most Spring Boot applications use this library to parse their own
application.yml
configuration file, which is considered as safe. If an attacker could changeapplication.yml
to exploit this vulnerability, they could cause much more damage than a DoS by just changing the properties, or by reading secrets.The Spring Boot policy for upgrading third party dependencies in our dependency management prevents us from upgrading this version in maintenance branches, 2.6.x and 2.7.x. Doing so would expose developers to possible behavior or API changes that would disrupt their application. We've discussed the possibility of making an exception to this policy, but this case happened in the past already with SnakeYaml 1.26 (see #20366); so far we don't see a reason to do so and we expect libraries maintainers to release patch versions for CVE fixes.
If your 2.6.x or 2.7.x application is using SnakeYaml to decode untrusted Yaml, for example from a web controller, you should override the SnakeYAML version property (
snakeyaml.version
) as soon as possible in your Gradle or Maven build.The text was updated successfully, but these errors were encountered: