Summary
Between 30 December 2024 and 4 March 2025 Python JSON Logger was vulnerable to RCE through a missing dependency.
This occurred because msgspec-python313-pre
was deleted by the owner leaving the name open to being claimed by a third party. If the package was claimed, it would allow them RCE on any Python JSON Logger user who installed the development dependencies on Python 3.13 (e.g. pip install python-json-logger[dev]
).
Based on the release history maintained by libraries.io I do not believe that a malicious actor exploited this vulnerability.
Affected Versions
Releases
Commits
2548e3a to e7761e5
Update 2025-03-15
The severity of this has been updated to Low from the original rating of High.
We are making this change as the PyPI admins have taken steps to block the name of the now missing package preventing it from being reclaimed.
For posterity the original rating was High - 8.8 based on CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
.
For further details see the discussion in #43
Original Report by @omnigodz
Summary
The PyPi package - "python-json-logger" which is owned and maintained by https://github.com/nhairs, is vulnerable to an RCE vulnerability by the abuse of a missing dependency - "msgspec-python313-pre".
Details
PyPi package link - https://pypi.org/project/python-json-logger
Project Link - https://github.com/nhairs/python-json-logger
PoC
During an experimental research regarding supply chain attacks, I discovered a big flaw affecting packages published on package managers
i.e. where I can Identify a package's dependency or dependencies which do not exist on the package manager and are not registered by any
entity which allows me to publish a malicious package with the same name. Therefore, the targetted package will now use my malicious dependency giving arbitrary code execution capabilities on the installer's system.
As explained in the above scenario, I was able to identify that the PyPi package - "python-json-logger" uses an optional dependency -
"msgspec-python313-pre" which is defined in the "pyproject.toml" file in the package version - "3.2.1" as it can be seen in this screen shot -
"https://drive.google.com/file/d/1HYEA99FjzsEQXegkoZ1CeZ4nnhmbMHej/view?usp=share_link" which was neither present on the PyPi repository and nor registered by any entity.
Therefore, I published a package with the same name - "msgspec-python313-pre" and version - "0.0.0.1".
This release did not had any malicious content as I do not want to break any policies set by PyPi.org and neither want to infect any of the users of the - "python-json-logger" package.
Also, just after publishing the package; I deleted the release as PyPi.org do not allow to publish even empty packages as they are seen as a typo-squatting attempt.
But still, the package name - "msgspec-python313-pre" is registered on my account with the username - "omnigodz" as it can be seen in this screenshot here - "
https://drive.google.com/file/d/1KGQhd5ck71AoXZeW_eOyJEqg3xvFFuKO/view?usp=share_link", which prevents any bad actor from uploading any actual malicious package with the same name.
Since, I have not actually published POC code in the dependency to showcase the impact. In order to see how I could have acheived RCE on the above mentioned package. Please feel free to checkout my recent research here specially from page 4 till 8 as it specifically demonstrates the attack scenario -
"https://drive.google.com/file/d/18qe97zxcpTn2l84187A9meGCi2Wg-n_Y/view?usp=share_link" which was showcased at the Seaside 2025 security conference by me.
This means that any user of the - "msgspec-python313-pre" package who installs it by running the command - "pip install python-json-logger[dev]" in the python 3.13.x environment will be installing the malicious dependency - "msgspec-python313-pre" automatically which can be seen in this
screenshot - "https://drive.google.com/file/d/14nDG2Thr6kjtd3s_qaL9GZI1E2YIKHhA/view?usp=share_link"
Also, for reference: please checkout this CVE here - https://nvd.nist.gov/vuln/detail/CVE-2022-40424
The main issue here is that - despite the dependency "msgspec-python313-pre" being removed from the project repository about a month ago through this commit - 1ce81a3, the changes were never pushed into the package - "python-json-logger" via a new version after 3.2.1 which leaves it vulnerable
Impact
The package - "python-json-logger" has over "46449874" monthly downloads according to the official PyPi BigQuery database which means if the optional dependency - "msgspec-python313-pre" is taken over by a threat actor. He/She can infect all of the users of the "python-json-logger" package with any possible malware.
Remediation
Either release a new version for the package - "python-json-logger" with the changes made in this specific commit - "1ce81a3" or takeover the dependency - "msgspec-python313-pre" ownership from me.
Summary
Between 30 December 2024 and 4 March 2025 Python JSON Logger was vulnerable to RCE through a missing dependency.
This occurred because
msgspec-python313-pre
was deleted by the owner leaving the name open to being claimed by a third party. If the package was claimed, it would allow them RCE on any Python JSON Logger user who installed the development dependencies on Python 3.13 (e.g.pip install python-json-logger[dev]
).Based on the release history maintained by libraries.io I do not believe that a malicious actor exploited this vulnerability.
Affected Versions
Releases
3.2.0
3.2.1
Commits
2548e3a to e7761e5
Update 2025-03-15
The severity of this has been updated to Low from the original rating of High.
We are making this change as the PyPI admins have taken steps to block the name of the now missing package preventing it from being reclaimed.
For posterity the original rating was High - 8.8 based on
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
.For further details see the discussion in #43
Original Report by @omnigodz
Summary
The PyPi package - "python-json-logger" which is owned and maintained by https://github.com/nhairs, is vulnerable to an RCE vulnerability by the abuse of a missing dependency - "msgspec-python313-pre".
Details
PyPi package link - https://pypi.org/project/python-json-logger
Project Link - https://github.com/nhairs/python-json-logger
PoC
During an experimental research regarding supply chain attacks, I discovered a big flaw affecting packages published on package managers
i.e. where I can Identify a package's dependency or dependencies which do not exist on the package manager and are not registered by any
entity which allows me to publish a malicious package with the same name. Therefore, the targetted package will now use my malicious dependency giving arbitrary code execution capabilities on the installer's system.
As explained in the above scenario, I was able to identify that the PyPi package - "python-json-logger" uses an optional dependency -
"msgspec-python313-pre" which is defined in the "pyproject.toml" file in the package version - "3.2.1" as it can be seen in this screen shot -
"https://drive.google.com/file/d/1HYEA99FjzsEQXegkoZ1CeZ4nnhmbMHej/view?usp=share_link" which was neither present on the PyPi repository and nor registered by any entity.
Therefore, I published a package with the same name - "msgspec-python313-pre" and version - "0.0.0.1".
This release did not had any malicious content as I do not want to break any policies set by PyPi.org and neither want to infect any of the users of the - "python-json-logger" package.
Also, just after publishing the package; I deleted the release as PyPi.org do not allow to publish even empty packages as they are seen as a typo-squatting attempt.
But still, the package name - "msgspec-python313-pre" is registered on my account with the username - "omnigodz" as it can be seen in this screenshot here - "
https://drive.google.com/file/d/1KGQhd5ck71AoXZeW_eOyJEqg3xvFFuKO/view?usp=share_link", which prevents any bad actor from uploading any actual malicious package with the same name.
Since, I have not actually published POC code in the dependency to showcase the impact. In order to see how I could have acheived RCE on the above mentioned package. Please feel free to checkout my recent research here specially from page 4 till 8 as it specifically demonstrates the attack scenario -
"https://drive.google.com/file/d/18qe97zxcpTn2l84187A9meGCi2Wg-n_Y/view?usp=share_link" which was showcased at the Seaside 2025 security conference by me.
This means that any user of the - "msgspec-python313-pre" package who installs it by running the command - "pip install python-json-logger[dev]" in the python 3.13.x environment will be installing the malicious dependency - "msgspec-python313-pre" automatically which can be seen in this
screenshot - "https://drive.google.com/file/d/14nDG2Thr6kjtd3s_qaL9GZI1E2YIKHhA/view?usp=share_link"
Also, for reference: please checkout this CVE here - https://nvd.nist.gov/vuln/detail/CVE-2022-40424
The main issue here is that - despite the dependency "msgspec-python313-pre" being removed from the project repository about a month ago through this commit - 1ce81a3, the changes were never pushed into the package - "python-json-logger" via a new version after 3.2.1 which leaves it vulnerable
Impact
The package - "python-json-logger" has over "46449874" monthly downloads according to the official PyPi BigQuery database which means if the optional dependency - "msgspec-python313-pre" is taken over by a threat actor. He/She can infect all of the users of the "python-json-logger" package with any possible malware.
Remediation
Either release a new version for the package - "python-json-logger" with the changes made in this specific commit - "1ce81a3" or takeover the dependency - "msgspec-python313-pre" ownership from me.