diff options
author | Daniel BORNAZ <daniel.bornaz@enea.com> | 2014-07-24 15:51:44 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-25 15:33:35 +0100 |
commit | 9ec213bf67afbdfdbe25802ec86487bb22aeb2e4 (patch) | |
tree | a630840df0d2559fca134baeb59d33f323e0ddfc /meta/recipes-devtools/python/python | |
parent | 191cab2f679491c2b6ddba49c5cf4886dcd22f57 (diff) | |
download | openembedded-core-contrib-9ec213bf67afbdfdbe25802ec86487bb22aeb2e4.tar.gz |
python: fix _json module arbitrary process memory read vulnerability
http://bugs.python.org/issue21529
Python 2 and 3 are susceptible to arbitrary process memory reading by
a user or adversary due to a bug in the _json module caused by
insufficient bounds checking.
The sole prerequisites of this attack are that the attacker is able to
control or influence the two parameters of the default scanstring
function: the string to be decoded and the index.
The bug is caused by allowing the user to supply a negative index
value. The index value is then used directly as an index to an array
in the C code; internally the address of the array and its index are
added to each other in order to yield the address of the value that is
desired. However, by supplying a negative index value and adding this
to the address of the array, the processor's register value wraps
around and the calculated value will point to a position in memory
which isn't within the bounds of the supplied string, causing the
function to access other parts of the process memory.
Signed-off-by: Benjamin Peterson <benjamin@python.org>
Applied to python-native recipe in order to fix the above mentioned
vulnerability.
Upstream-Status: Submitted
Signed-off-by: Daniel BORNAZ <daniel.bornaz@enea.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python')
-rw-r--r-- | meta/recipes-devtools/python/python/json-flaw-fix.patch | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/json-flaw-fix.patch b/meta/recipes-devtools/python/python/json-flaw-fix.patch new file mode 100644 index 00000000000..e9a6cca0179 --- /dev/null +++ b/meta/recipes-devtools/python/python/json-flaw-fix.patch @@ -0,0 +1,27 @@ + +python: fix _json module arbitrary process memory read vulnerability + +Upstream-Status: submitted + +Signed-off-by: Daniel BORNAZ <daniel.bornaz@enea.com> + +--- a/Modules/_json.c 2014-07-15 15:37:17.151046356 +0200 ++++ b/Modules/_json.c 2014-07-15 15:38:37.335605042 +0200 +@@ -1491,7 +1491,7 @@ scan_once_str(PyScannerObject *s, PyObje + PyObject *res; + char *str = PyString_AS_STRING(pystr); + Py_ssize_t length = PyString_GET_SIZE(pystr); +- if (idx >= length) { ++ if ( idx < 0 || idx >= length) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } +@@ -1578,7 +1578,7 @@ scan_once_unicode(PyScannerObject *s, Py + PyObject *res; + Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); + Py_ssize_t length = PyUnicode_GET_SIZE(pystr); +- if (idx >= length) { ++ if ( idx < 0 || idx >= length) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } |