From: Saul Wold <sgw@linux.intel.com>
To: Daniel BORNAZ <daniel.bornaz@enea.com>,
yocto@yoctoproject.org,
openembedded-core@lists.openembedded.org
Cc: Benjamin Peterson <benjamin@python.org>
Subject: Re: [yocto] [PATCH] _json module arbitrary process memory read vulnerability
Date: Fri, 18 Jul 2014 11:14:47 -0700 [thread overview]
Message-ID: <53C96417.7020603@linux.intel.com> (raw)
In-Reply-To: <1405592877-16855-1-git-send-email-daniel.bornaz@enea.com>
On 07/17/2014 03:27 AM, Daniel BORNAZ wrote:
> python-native: _json module arbitrary process memory read vulnerability
>
This should be the proper subject of the mail and commit, please update
and see below.
> 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>
>
> ---
> meta/recipes-devtools/python/python-native_2.7.3.bb | 1 +
> .../python/python/python-json-flaw-fix.patch | 20 ++++++++++++++++++++
> 2 files changed, 21 insertions(+)
> create mode 100644 meta/recipes-devtools/python/python/python-json-flaw-fix.patch
>
> diff --git a/meta/recipes-devtools/python/python-native_2.7.3.bb b/meta/recipes-devtools/python/python-native_2.7.3.bb
> index 0571d3a..74f0dfc 100644
> --- a/meta/recipes-devtools/python/python-native_2.7.3.bb
> +++ b/meta/recipes-devtools/python/python-native_2.7.3.bb
> @@ -19,6 +19,7 @@ SRC_URI += "\
> file://parallel-makeinst-create-bindir.patch \
> file://python-fix-build-error-with-Readline-6.3.patch \
> file://gcc-4.8-fix-configure-Wformat.patch \
> + file://python-json-flaw-fix.patch \
> "
> S = "${WORKDIR}/Python-${PV}"
>
> diff --git a/meta/recipes-devtools/python/python/python-json-flaw-fix.patch b/meta/recipes-devtools/python/python/python-json-flaw-fix.patch
> new file mode 100644
> index 0000000..631713d
This patch file needs a Signed-off-by and Upstream-Status.
Thanks
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python/python-json-flaw-fix.patch
> @@ -0,0 +1,20 @@
> +--- 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;
> + }
>
prev parent reply other threads:[~2014-07-18 18:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 10:27 [PATCH] _json module arbitrary process memory read vulnerability Daniel BORNAZ
2014-07-17 16:26 ` Saul Wold
2014-07-18 18:14 ` Saul Wold [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C96417.7020603@linux.intel.com \
--to=sgw@linux.intel.com \
--cc=benjamin@python.org \
--cc=daniel.bornaz@enea.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox