GHSL-2023-208: Unsafe deserialization in MkDocs
MkDocs loads YAML configuration files using an unsafe loader that can instantiate arbitrary Python objects, allowing an attacker who controls a theme's configuration file to execute arbitrary code. This could lead to remote code execution on developer machines or CI/CD systems.
MkDocs is vulnerable to an unsafe deserialization when parsing configuration files.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The YAML loader used (yaml.Loader) can instantiate arbitrary Python objects, which is unsafe when parsing untrusted configuration files.
Impact
This issue may lead to Remote Code Execution, potentially giving an attacker access to CI/CD systems and developer machines.
What the attacker needed
Attacker controls a theme's mkdocs_theme.yml; victim installs and uses the theme
How it was found
- Install a theme such as dracula.
- Replace the theme's mkdocs_theme.yml with malicious content.
- Run mkdocs and check for the created file.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
MkDocs is a tool that builds documentation websites from text files. It reads configuration files in a format called YAML, and the way it reads them allows someone to sneak in instructions that run commands on your computer. If you install a malicious theme, it could take over your machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.