gh-148954: sanitize methodname in xmlrpc.client.dumps() to prevent XML injection#148968
gh-148954: sanitize methodname in xmlrpc.client.dumps() to prevent XML injection#148968sanyamk23 wants to merge 5 commits intopython:mainfrom
Conversation
…ent XML injection
4c5e015 to
4e67dfd
Compare
picnixz
left a comment
There was a problem hiding this comment.
- Please sign the CLA.
- Please don't use LLM to generate your PRs or summary. See https://devguide.python.org/getting-started/generative-ai/.
- Add tests if possible.
- Don't force push and don't update your PR with the "Update branch" button. In particular, read the devguide.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
picnixz
left a comment
There was a problem hiding this comment.
cc @sethmlarson @StanFromIreland (I think this was a GHSA right? I didn't follow the discussion so there might be more that you wanted to add).
| @@ -0,0 +1,2 @@ | |||
| Fix XML injection vulnerability in :func:`xmlrpc.client.dumps` where the ``methodname`` | |||
There was a problem hiding this comment.
@StanFromIreland Was it expected to be fixed as a regular bugfix or security issue? in the former case, please move the NEWS entry to "Library" (the esasiest way to do it is simply to remove that file and re-create one from scratch).
There was a problem hiding this comment.
This was expected to be treated as a regular bugfix, please do move it to "library," otherwise it is misleading and contradicts the security warning.
|
FTR: this was GHSA-w5gj-44cx-wmcj. |
Summary
This PR fixes an XML injection vulnerability in
xmlrpc.client.dumps()where themethodnamewas interpolated directly into the<methodName>tag without escaping.Details
The
methodnameis now passed through the module'sescape()helper function before being added to the XML request body. This prevents attackers from injecting arbitrary XML markup if they can control the method name.Verification
'foo</methodName><injected attr="evil"/><methodName>bar'is correctly escaped as'foo</methodName><injected attr="evil"/><methodName>bar'.Fixes gh-148954