3 ms·
From the PDF, these are some of the security vulnerabilities that the static analysis came up with: Use of the exec function Insecure permissions for files B
by simonw 5y ago
From the PDF, these are some of the security vulnerabilities that the static analysis came up with:
Use of the exec function
Insecure permissions for files
Binding a socket to all network interfaces
Use of hard-coded passwords in non-function contexts
Use of hard-coded passwords in function arguments
Use of hard-coded passwords in default function arguments
Use of hard-coded temporary directories
Using pass as a catch-all-style exception handling
Using continue as a catch-all-style exception handling
Running a Flask web application in debug mode
Use of insecure deserialization
Use of insecure deserialization
Use of MD2, MD4, MDS, or SHA1 hash functions
Use of insecure ciphers such as DES
Use of insecure cipher modes
Use of the insecure mkt emp function
Use of the possibly insecure eval function
Use of the possibly insecure mark_safe function
Use of the insecure HTTPSConnection with some Python versions
Use of a file scheme in urlopen with some Python versions
Use of pseudo-random generators for cryptography/security tasks
Use of the insecure Telnet protocol
Use of possibly insecure Extensible Markup Language (XML) parsing
Most of those can be used securely (e.g. the mark_safe() function is specifically intended for context where the user understands what they are doing - some people may mess it up, but its presence does not indicate a security vulnerability). So the "at least one issue is present for about 46% of the Python packages" number doesn't worry me too much.
- keithalewis 5y agos/can/will most likely/. The typical python programmer has a whistle and readily available graveyard. :-)
- make3 5y agowhy is mktemp insecure?
- goodside 5y agoPython mktemp has been deprecated since 2003. I there’s a race condition that allows a malicious process to slip in a file or symlink with different permissions at the path mktemp returns.
- tyingq 5y agoJust for clarity, the race condition seems deliberate. It just returns a path and leaves it to you to create the file.
- goodside 5y agoYes — the core problem is you can’t be guaranteed exclusive write access to a path without actually creating a file or directory. The warning in the docs (https://docs.python.org/3/library/tempfile.html#tempfile.mktemp https://docs.python.org/3/library/tempfile.html#tempfile.mkt...) aims to show an example of how to get “just a path” by making and deleting a NamedTemporaryFile, but the example is confusing and has unnecessary steps. Seems like you could just do `with NamedTemporaryFile() as f: path = f.name`. Also, the warning seems to imply using `NamedTemporaryFile` addresses the race condition, but it doesn’t — the problem exists even for “secure” methods any time you re-use the path after cleanup.
- slaymaker1907 5y agoI agree most can be used securely, but I can't think of any legitimate use for DES in 2021. The old hash functions obviously have utility in non-secure contexts, but not really symmetric encryption.
- BeefWellington 5y agoI can think of one specific use case: supporting an upgrade path for older versions of a given application. That's about it though.