No, there is nothing inherently insecure about python. However Python can be used to make a vulnerability. For instance it would be easy to make a web portal that executes anything that is typed in. This is true for any programming language, but python makes it extra easy. And I know, you would know better, but IT departments see all their users as idiots (often with good reason). Answer from novel_yet_trivial on reddit.com
🌐
Security Compass
securitycompass.com › home › kontra › is python secure?
Is Python Secure? - Kontra Hands-on Labs
November 11, 2025 - Python is generally secure, but like any language, its security depends on how it is used and the practices developers follow.
🌐
Reddit
reddit.com › r/python › is python a security vulnerability?
r/Python on Reddit: Is Python a Security Vulnerability?
November 20, 2017 -

I recently sent a request to my employer's IT department asking for access to Python 3.6.3. The request was denied with the justification "Python is dangerous to have on a pc. It is a useful attack vector."

Can anyone provide insight on what this might mean? Does simply having Python installed on your computer make you more susceptible to attacks? I can't tell if my employer has a valid concern here or if they are just taking the easy route.

EDIT: Spelling

Discussions

cryptanalysis - Is python a secure programming language for cryptography? - Cryptography Stack Exchange
I know Python is a powerful programming language but is it secure for cryptography? I mean is it possible to reverse engineer the program (written in python) and discover the algorithm of cryptogra... More on crypto.stackexchange.com
🌐 crypto.stackexchange.com
November 2, 2014
Is it use python 2.7 version safe for security and other things. if not how much risk there
My project had developed using python 2.7 version , so is it safe to use/download python 2.7? , my project needs use python 2.7 version for maintain and enhancements. please help me on same Thanks Karthik A More on discuss.python.org
🌐 discuss.python.org
0
0
June 9, 2022
Python Security Question
After looking into it, I have concerns over the use of Python as it can do and control a lot of things these employees should not have access too. I have read it can communicate to Cisco Switches, Servers, or other PCs. So, from a security point of view of protecting my network and not allowing access, how secure is ... More on community.spiceworks.com
🌐 community.spiceworks.com
8
11
November 17, 2020
Potential Security Risks of using Python at Work
A few people have given plausible guesses, but the fact is we can't know how to answer this because we don't know where you work, what systems you're trying to install python and what the security requirements of those systems are. There are a million possible reasons the IT people responsible for security might not want a general-purpose programming environment on a given system. Unfortunately, you have to ask them which ones they are actually concerned about. More on reddit.com
🌐 r/learnpython
54
4
January 21, 2025
People also ask

Why is Python security important in software development?
Python security is crucial because Python is widely used in building web applications, automation scripts, data pipelines, and even financial platforms—making it a prime target for cyber threats. Poorly secured Python code can lead to data breaches, unauthorized access, code injection attacks, and severe system vulnerabilities. By following security best practices, developers can safeguard sensitive information, ensure regulatory compliance, and build user trust. Additionally, as applications scale and integrate with external services or APIs, the risk of exposure increases—so prioritizing sec
🌐
binmile.com
binmile.com › blog › python-security-best-practices-and-strategies
Top 7 Python Security Best Practices: What You Need to Know
What is Python secure coding and why is it important?
Python secure coding refers to writing code that defends against security vulnerabilities such as code injection, cross-site scripting (XSS), and data exposure. It involves validating user inputs, avoiding hardcoded credentials, using secure libraries, and applying proper authentication mechanisms. At Binmile, we embed secure coding principles into the development lifecycle to protect our clients’ applications from evolving cyber threats.
🌐
binmile.com
binmile.com › blog › python-security-best-practices-and-strategies
Top 7 Python Security Best Practices: What You Need to Know
How does Binmile ensure the security of Python applications developed for clients?
Binmile follows secure coding guidelines and best practices throughout the development lifecycle. We conduct code reviews with a focus on identifying potential security vulnerabilities. We utilize static and dynamic application security testing (SAST/DAST) tools to automate vulnerability detection. Our team stays updated on the latest security threats and proactively implements preventative measures. We can provide penetration testing services to evaluate the security posture of the application. We emphasize the importance of secure deployment practices and ongoing security monitoring.
🌐
binmile.com
binmile.com › blog › python-security-best-practices-and-strategies
Top 7 Python Security Best Practices: What You Need to Know
🌐
Aqua Security
aquasec.com › home › application security › python security
Python Security: 6 Common Risks & What You Can Do About Them
July 23, 2024 - Python has a number of built-in features and libraries that can help developers write secure code, such as input validation and sanitization, and secure web frameworks such as Django and Flask.
Top answer
1 of 3
15

Python is a scripting language, so if you've got the program, you usually also have the source code. So you don't even have to reverse-engineer. That doesn't matter much for two reasons:

  • other languages are pretty easy to reverse engineer (or they are complex for both the programmer and the attacker);
  • the algorithm does not have to be kept safe anyway, due to Kerckhoffs' principle

Now the above does not directly make Python suitable for cryptography. One of the main things about cryptography is security. Without a secure programming environment, you can have any strength of cryptography, and still not have a secure system.

Languages have many constructs that make them more or less suitable for security and cryptography, so I show a few and indicate how Python fares:

  • type system: it has a dynamic type system with strong typing - with regards to security this is not as good as a static type system but it is better than weak typing;

  • character encoding: not good, python may confuse bytes and characters if specialized classes are not used;

  • operations on bytes, 16 bit words, 32 bit words and 64 bit words: not good, python simply regards everything as an unbounded number;

  • operations on large integers: good; modular exponentiation can be done directly on numbers using pow();

  • destruction of keys & state: this is a problem for any language that doesn't directly manage it's memory; Python is not likely to fair better than the rest, it may be hard to prove that keys can be safely destroyed while the program is running.

Finally, in general people like their systems to be fast. Unfortunately, scripting languages are often not fast with regards to binary operations required for symmetric cryptography (SHA-256, AES). Interpreted languages such as Java are already much faster, but languages such as C and assembly are faster than that (when used correctly).

More important for regular use of cryptography is the maturity of cryptographic support provided in libraries. Python has a relatively well kept crypto libraries called PyCrypto, PyOpenSSL available; those libraries however are mainly implemented mainly in C. These and other libraries are discussed here. One advantage of PyOpenSSL is that it should be possible to securely store and use keys from a hardware module (for instance a smart card or HSM).

Note that side channels may apply when using Python for direct implementation of cryptographic primitives. I'd say that Python is especially OK for fast prototyping of cryptographic primitives rather than library creation.

All in all, I would summarize that Python is OK-ish, but not great for cryptography if such a generalist statement can be made at all.

2 of 3
10

The point of cryptography is having algorithms that are secure even when the attacker knows them. Google security by obscurity to see why it's bad.

I'll add the following based on otus comment. Python can be reverse engineered, so you can't hide your algorithms. Basically, if someone can run your code, they can reverse engineer the algorithms. The point of crypto is that you can publish all your algorithms to the world, and, unless you tell them some secret key, they won't be able to break the encryption.

However, in practice you'll have issues like side channel attacks, i.e. the code leaks information about the data it's processing. This includes secret keys. This will pop up in any programming language unless you really know what you're doing. If you use a crypto library in Python, then most of these issues are more or less a problem of the library writer, so you need to trust that they know what they're doing, but even the user can use the library in bad ways.

To conclude, Python is neither better or worse than any other programming language as long as you use a good crypto library. However, if you're thinking about implementing something like RSA yourself or some other crypto algorithm you found in a book/paper, then most probably the code will be vulnerable unless you're an expert and you really know what you're doing. This applies to any language.

🌐
Python
python.org › dev › security
Python Security | Python.org
See the security issue information for pypi.org here. The Python Software Foundation and the Python developer community take security vulnerabilities very seriously. A Python Security Response Team (PSRT) has been formed that does triage on all reported vulnerabilities and works to resolve them.
🌐
Quora
quora.com › Is-Python-safe-for-my-computer
Is Python safe for my computer? - Quora
Answer (1 of 6): Considering Python is in regular use across tens of thousands of computer systems across the world; everything from desktop machines, to internet servers, to small devices on the Internet of Things. There is no reason to suspect that Python is any less safe than any other softwa...
Find elsewhere
🌐
Quora
quora.com › Is-the-Python-language-secure
Is the Python language secure? - Quora
Answer (1 of 4): Security has very little to do with the language. You can do very secure things is any language, and also very insecure things. The program usually does what you tell it to do, if you are sloppy and careless then the software ...
🌐
ActuIA
actuia.com › en › news › is-python-secure
Is Python secure?
February 14, 2025 - In more than 60% of Python projects, there are code-related items present in the OWASP TOP 10 2021 issues. These types of issues can lead cybercriminals to inject client-side scripts into websites (XSS).
🌐
Python.org
discuss.python.org › python help
Is it use python 2.7 version safe for security and other things. if not how much risk there - Python Help - Discussions on Python.org
June 9, 2022 - My project had developed using python 2.7 version , so is it safe to use/download python 2.7? , my project needs use python 2.7 version for maintain and enhancements. please help me on same Thanks Karthik A
🌐
Binmile
binmile.com › blog › python-security-best-practices-and-strategies
Top 7 Python Security Best Practices: What You Need to Know
July 16, 2025 - It’s imperative to secure your ... of cloud secrets, and personally identifiable information. Of course, properly written Python code can be secure, but code that is not written securely can leave your application vulnerable ...
Address   2803 Philadelphia Pike, Suite B 191, 19703, Claymont
🌐
Spectral
spectralops.io › home › 4 reasons why python libraries are not secure
4 Reasons why Python libraries are not secure - Spectral
August 23, 2024 - Typosquatting: This is similar to typosquatting but in Python. Most attackers create libraries with names identical to the original, so developers accidentally install the malicious library, not the original. Dependency Vulnerabilities: Some libraries depend on other libraries to implement their functionality. When one dependent library has a vulnerability, it ultimately affects the parent library. These security vulnerabilities ultimately make your application less secure as these libraries could send your data to an attacker or record your activities.
🌐
Aptori
aptori.com › blog › python-security-cheat-sheet-for-developers
Python Security Cheat Sheet for Developers
Run your Python applications with the least privilege necessary. Avoid running scripts as root or Administrator unless required. Secure coding is an ongoing process. Continuously educate yourself on new threats and vulnerabilities.
🌐
Safety
getsafety.com › blog-posts › python-security-best-practices-for-developers
Python Security: Best Practices for Developers | Safety Blog
Safety gives security teams real-time visibility and governance over every AI tool, package, MCP server, and IDE extension across their developer fleet.
🌐
Black Duck
blackduck.com › blog › python-security-best-practices.html
Six Python Security Best Practices for Developers | Black Duck Blog
March 18, 2024 - You should always use up-to-date code to make sure that your software will work without issues and won’t open doors for attackers. Python is no exception to this rule. If we compare Python versions 2 and 3, there are major security advancements in the later release that should help keep your software secure.
🌐
Snyk
snyk.io › blog › python-security-best-practices-cheat-sheet
Python security best practices cheat sheet | Snyk
September 27, 2021 - It’s important to note that Snyk’s data about the Python ecosystem, as well as academic research, shows that Python is no more (or less) secure than other widely used languages.
🌐
Reddit
reddit.com › r/learnpython › potential security risks of using python at work
r/learnpython on Reddit: Potential Security Risks of using Python at Work
January 21, 2025 -

So I wanted to install Python, download Selenium library on it, and combine it with Webdriver to access web-driven accounting software to automate some stuff; mainly downloading reports from the accounting software since there are tones of reports to download every month, which the software does not have automation function for. I don't want to deal with any data.

Senior director and I went to IT for the request to download Python and they declined; they said there is a security risk.

Does anyone know what potential security risks they are referring to? I don't have cs background so I'm not very sure. And is there a way to mitigate those risks?

🌐
TheServerSide
theserverside.com › tip › The-dangers-of-Python-import-and-how-enterprises-can-be-safe
The dangers of Python import and how enterprises can be safe | TheServerSide
July 21, 2023 - Python's ability to execute code at import presents three levels of risk to an enterprise: accidental risk, deliberate risk and external risk. Accidental risk is when a developer modifies or adds something to the top-level body of an import, ...
🌐
Nocomplexity
nocomplexity.com › checklist-using-python
Avoid a Security Disaster: How to Safely Use Any Python Program – NO Complexity
October 27, 2025 - Python’s dominance as a programming language makes it a prime target for security risks. In today’s digital world, security isn’t guaranteed: a solid architecture helps, but even well-written code—including AI-generated code—is not secure by default.