CVE-2013-7459: Heap-based buffer overflow in Python Cryptography Toolkit (pycrypto)

pycrypto Updated 02 Oct 2025

Summary

15/02/2017
Yes i
Critical
9.8

CVE-2013-7459: Heap-based buffer overflow in the ALGnew function in block_templace.c in Python Cryptography Toolkit (aka pycrypto) allows remote attackers to execute arbitrary code as demonstrated by a crafted iv parameter to cryptmsg.... Affects pycrypto versions < 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4. Fixed in 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Python Cryptography Toolkit (pycrypto) is a library for cryptographic algorithms and protocols in Python. It provides various cryptographic services, including encryption, decryption, hashing, and random number generation. The vulnerability in pycrypto is a heap-based buffer overflow in the ALGnew function in block_templace.c. This vulnerability allows remote attackers to execute arbitrary code by exploiting a crafted iv parameter in the cryptmsg.py script.

Vulnerability Detail

The vulnerability in pycrypto arises from a heap-based buffer overflow in the ALGnew function. This function is responsible for creating a new algorithm object for block ciphers. By providing a specially crafted iv parameter to the cryptmsg.py script, an attacker can trigger the buffer overflow and potentially execute arbitrary code on the target system. This can lead to various consequences, including remote code execution, privilege escalation, and information disclosure.

How To Fix

Latest published version: 2.6.1 as of 22 Oct 2026

pip install --upgrade "pycrypto==2.6.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4

This is the first release that contains the fix.

pip install --upgrade "pycrypto==8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. However, as a general best practice, it is recommended to ensure that the pycrypto library is kept up to date with the latest security patches and updates. Additionally, users should exercise caution when processing untrusted input and avoid using vulnerable versions of pycrypto in critical systems.

Conclusion

The vulnerability in pycrypto allows remote attackers to execute arbitrary code through a heap-based buffer overflow. To mitigate this vulnerability, it is crucial to update pycrypto to a version that includes the fix. Users should also follow best practices for secure coding and input validation. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for pycrypto →

Share this vulnerability

FAQ

The vulnerability allows remote attackers to execute arbitrary code, which can lead to various consequences such as remote code execution, privilege escalation, and information disclosure.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just Pipfile.lock without requiring access to the code or installation.

While specific exploits for this vulnerability are not mentioned, it is important to address the vulnerability promptly by updating pycrypto to a fixed version to mitigate the risk of potential exploits.

Yes, this vulnerability can be exploited remotely by sending a specially crafted iv parameter to the cryptmsg.py script.

There is no specific information provided about active exploitation of this vulnerability. However, it is always recommended to address security vulnerabilities promptly to minimize the risk of potential exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for pycrypto.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 2.6.1 as of 22 Oct 2026

pip install --upgrade "pycrypto==2.6.1"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4

This is the first release that contains the fix.

pip install --upgrade "pycrypto==8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback