Executive brief
A vulnerability exists in the Python standard library's configuration file parser, which is used by developers to read and write settings files. If an application allows untrusted users to provide text that is then saved into a configuration file, those users could inject unauthorized settings or modify existing ones. This could lead to unauthorized changes in how an application behaves or bypass security controls that rely on those configuration files.
Technical details
A configuration injection vulnerability exists in the Python 'configparser' module's write() method. The root cause is insufficient normalization of line endings; while the module correctly handles newline characters (\n) by indenting them for multi-line values, it fails to properly handle carriage return characters (\r). An attacker with the ability to provide input that is subsequently written to a configuration file can use \r characters to terminate a value and start a new, unauthorized configuration key or section. This is reachable if an application uses configparser to persist user-controlled data. The issue is addressed by normalizing all line endings (CR, CRLF, and LF) to the standard LF+TAB format during the write operation. Patches are available in CPython versions 3.10 through 3.14, with a full fix in 3.15.0.
Affected products
- Python Software Foundation CPython < 3.15.0
Timeline
- 2026-01-16: disclosed: Issue reported on GitHub
- 2026-06-23: advisory: Security announcement published by Python Software Foundation