CVE-2015-8557: Pygments - Arbitrary Command Execution
Summary
CVE-2015-8557: The FontManager._get_nix_font_path function in formatters/img.py in Pygments 1.2.2 through 2.0.2 allows remote attackers to execute arbitrary commands via shell metacharacters in a font name. Affects pygments versions >= 1.2.2, < 2.1. Fixed in 2.1. How to fix ↓
Also tracked for
- pygments · Debian:11
The same CVE-2015-8557 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Pygments is a syntax highlighting package for various programming languages and markup formats. It provides a way to format and colorize source code for better readability. The vulnerability in Pygments version 1.2.2 through 2.0.2 allows remote attackers to execute arbitrary commands by exploiting shell metacharacters in a font name.
Vulnerability Detail
The vulnerability lies in the FontManager._get_nix_font_path function in the img.py file of Pygments. By manipulating the font name and injecting shell metacharacters, an attacker can execute arbitrary commands on the target system. This can lead to unauthorized access, data leakage, or even complete compromise of the system. It is important to note that this vulnerability affects Pygments versions 1.2.2 through 2.0.2.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "pygments==2.21.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.1
This is the first release that contains the fix.
pip install --upgrade "pygments==2.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no specific workaround mentioned for this vulnerability. The best course of action is to upgrade to the latest version of Pygments.
Conclusion
The vulnerability in Pygments allows remote attackers to execute arbitrary commands on the target system. To mitigate this risk, it is crucial to upgrade to Pygments version 2.1 or later. This ensures that the vulnerability is patched and the system is secure. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for pygments →
FAQ
Pygments is a syntax highlighting package used for formatting and colorizing source code in various programming languages and markup formats.
This vulnerability allows remote attackers to execute arbitrary commands on the target system, potentially leading to unauthorized access, data leakage, or complete compromise of the system.
Pygments versions 1.2.2 through 2.0.2 are affected by this vulnerability.
To fix this vulnerability, it is recommended to upgrade Pygments to version 2.1 or later.
There is no specific workaround mentioned for this vulnerability. Upgrading to the latest version is the recommended solution.
Related vulnerabilities
Recent vulnerabilities recorded for pygments.