High severityNVD Advisory· Published Aug 20, 2013· Updated Apr 29, 2026
CVE-2013-2161
CVE-2013-2161
Description
XML injection vulnerability in account/utils.py in OpenStack Swift Folsom, Grizzly, and Havana allows attackers to trigger invalid or spoofed Swift responses via an account name.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
swiftPyPI | < 1.9.0 | 1.9.0 |
Affected products
4Patches
492d7eadd3287Better escaping for GET /v1/a?format=xml.
2 files changed · +38 −1
swift/account/utils.py+1 −1 modified@@ -96,7 +96,7 @@ def account_listing_response(account, req, response_content_type, broker=None, account_list = json.dumps(data) elif response_content_type.endswith('/xml'): output_list = ['<?xml version="1.0" encoding="UTF-8"?>', - '<account name="%s">' % saxutils.escape(account)] + '<account name=%s>' % saxutils.quoteattr(account)] for (name, object_count, bytes_used, is_subdir) in account_list: name = saxutils.escape(name) if is_subdir:
test/unit/account/test_server.py+37 −0 modified@@ -632,6 +632,43 @@ def test_GET_with_containers_xml(self): self.assertEquals(node.firstChild.nodeValue, '4') self.assertEquals(resp.charset, 'utf-8') + def test_GET_xml_escapes_account_name(self): + req = Request.blank( + '/sda1/p/%22%27', # "' + environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '0'}) + self.controller.PUT(req) + + req = Request.blank( + '/sda1/p/%22%27?format=xml', + environ={'REQUEST_METHOD': 'GET', 'HTTP_X_TIMESTAMP': '1'}) + resp = self.controller.GET(req) + + dom = xml.dom.minidom.parseString(resp.body) + self.assertEquals(dom.firstChild.attributes['name'].value, '"\'') + + def test_GET_xml_escapes_container_name(self): + req = Request.blank( + '/sda1/p/a', + environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '0'}) + self.controller.PUT(req) + + req = Request.blank( + '/sda1/p/a/%22%3Cword', # "<word + environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '1', + 'HTTP_X_PUT_TIMESTAMP': '1', 'HTTP_X_OBJECT_COUNT': '0', + 'HTTP_X_DELETE_TIMESTAMP': '0', 'HTTP_X_BYTES_USED': '1'}) + self.controller.PUT(req) + + req = Request.blank( + '/sda1/p/a?format=xml', + environ={'REQUEST_METHOD': 'GET', 'HTTP_X_TIMESTAMP': '1'}) + resp = self.controller.GET(req) + dom = xml.dom.minidom.parseString(resp.body) + + self.assertEquals( + dom.firstChild.firstChild.nextSibling.firstChild.firstChild.data, + '"<word') + def test_GET_limit_marker_plain(self): req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT', 'HTTP_X_TIMESTAMP': '0'})
6659382c4fa3Check user input in XML responses.
1 file changed · +1 −1
swift/account/server.py+1 −1 modified@@ -241,7 +241,7 @@ def GET(self, req): account_list = json.dumps(data) elif out_content_type.endswith('/xml'): output_list = ['<?xml version="1.0" encoding="UTF-8"?>', - '<account name="%s">' % account] + '<account name="%s">' % saxutils.escape(account)] for (name, object_count, bytes_used, is_subdir) in account_list: name = saxutils.escape(name) if is_subdir:
4eed6bf5b502Check user input in XML responses.
1 file changed · +1 −1
swift/account/server.py+1 −1 modified@@ -275,7 +275,7 @@ def GET(self, req): account_list = json.dumps(data) elif out_content_type.endswith('/xml'): output_list = ['<?xml version="1.0" encoding="UTF-8"?>', - '<account name="%s">' % account] + '<account name="%s">' % saxutils.escape(account)] for (name, object_count, bytes_used, is_subdir) in account_list: name = saxutils.escape(name) if is_subdir:
8f9b135e0a16Checked user input in XML responses.
1 file changed · +1 −1
swift/account/utils.py+1 −1 modified@@ -96,7 +96,7 @@ def account_listing_response(account, req, response_content_type, broker=None, account_list = json.dumps(data) elif response_content_type.endswith('/xml'): output_list = ['<?xml version="1.0" encoding="UTF-8"?>', - '<account name="%s">' % account] + '<account name="%s">' % saxutils.escape(account)] for (name, object_count, bytes_used, is_subdir) in account_list: name = saxutils.escape(name) if is_subdir:
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
11- github.com/advisories/GHSA-9xgv-6v35-mmcjghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2013-2161ghsaADVISORY
- github.com/openstack/swift/commit/4eed6bf5b5028409f730be97ddcfb6bfa893c976ghsaWEB
- github.com/openstack/swift/commit/92d7eadd328797d392758c79e258c8455874c80eghsaWEB
- lists.opensuse.org/opensuse-updates/2013-07/msg00021.htmlnvdWEB
- rhn.redhat.com/errata/RHSA-2013-0993.htmlnvdWEB
- www.debian.org/security/2012/dsa-2737nvdWEB
- www.openwall.com/lists/oss-security/2013/06/13/4nvdWEB
- bugs.launchpad.net/swift/+bug/1183884nvdWEB
- github.com/openstack/swift/commit/6659382c4fa348e1ebbce2424968dd7267ea1db1ghsaWEB
- github.com/openstack/swift/commit/8f9b135e0a16478a628f20224ce5babe62d4aabaghsaWEB
News mentions
0No linked articles in our index yet.