Live data from Hacker News

Python 3.x: RCE in Python applications that accept floats as untrusted input

cve.mitre.org

31–40 of 72 posts

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#31
post #30

This inspired me to grep the cpython code for sprintf. I found one used with the return value from alloca (inside FindAddress in _ctypes.c). It checks alloca for NULL (does alloca ever return NULL?), but I could imagine it might expoitable. FindAddress is a static function that can be called during DLL loading. I imagine that there is very little code that accepts untrusted arguments to DLL loading though (if so, the…

[deleted]

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#34
post #9

Remediation for this vulnerability basically caused complete gridlock for the internal tools at a certain FAANG company today.

The "elite" engineers are using ctypes in production? ctypes has never been considered even remotely secure, it can call any library function, including, drumroll, sprintf!

I’m sure the issue was more about patching their Python.

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#35
post #17

Earlier quoted context omitted.

Distros are backporting security patches into their releases, so no harm done. If you rely on the python.org releases and don't build from source, then yes, that is a bit sad. Case in point: The Debian security tracker, see their notes section referencing each commit. https://security-tracker.debian.org/tracker/CVE-2021-3177

The python:3.8 and python:3.9 container images if used to build web services such as Django with GIS extensions may have an RCE until Python.org sources are updated.

Why can't the base image receive those patches as well?

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#36
post #35

Earlier quoted context omitted.

The python:3.8 and python:3.9 container images if used to build web services such as Django with GIS extensions may have an RCE until Python.org sources are updated.

Why can't the base image receive those patches as well?

Those images pull from python.org sources, see:

https://github.com/docker-library/python/blob/master/3.8/bus...

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#37
post #26

Earlier quoted context omitted.

Facebook, Apple, Amazon, Netflix, Google

What's the one that also includes Microsoft? FANMAG? I recall there was something but can't remember what...

IIRC that would be FAMANG, but I like FanMag.

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#38

Earlier quoted context omitted.

In the early 2000s COBRA reorganized as FAANG in response to changing geopolitical realities.

Who’s GI Joe now?

After his tour ended he ran for president and won.

Re: Python 3.x: RCE in Python applications that accept floats as untrusted input

#40

Minimal example: >>> import ctypes >>> x = ctypes.c_double.from_param(1e300) >>> repr(x) Segmentation fault This happens when getting the string representation of a foreign function float. It doesn't affect the standard builtin float type. So it's not extremely common. But I can imagine this cropping up if you e.g. find a way to cause an exception that formats a value. Or if there's aggressive logging.

FWIW this also crashes Python 2.7 on macOS Catalina.
Post reply on HN