appsec.fyi

Python — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

Python: A Practical Guide

Curated and synthesized by . Last updated 2026-11-01. Synthesized from 223 of 223 curated resources. Browse all 223 Python resources →

Problem Framing

Python's dynamic nature, extensive ecosystem, and ease of use make it a popular choice for a wide range of applications, from web services and data science to scripting and automation. However, these same characteristics can introduce significant security vulnerabilities if not managed carefully. Application security practitioners must understand Python's inherent risks, particularly in areas like deserialization, supply chain integrity, code execution, and secrets management, to effectively secure Python-based systems.

Core Mechanics

Python's security landscape is shaped by several core mechanics:

Notable Techniques

Several techniques are frequently leveraged by attackers targeting Python applications:

Detection & Prevention

Effective security for Python applications requires a multi-layered approach:

Tooling

A variety of tools can aid in securing Python applications:

Recent Developments

The Python security landscape is constantly evolving:

Where to Go Deeper

To further deepen your understanding and capabilities in securing Python applications:

Sources cited in this guide

  1. Escalating Deserialization Attacks in Python — frichetten.com
  2. Exploiting Python Pickles - David Hamann — davidhamann.de
  3. How Python Pickle Deserialization Security Exploit Works — securecodingpractices.com
  4. Insecure Deserialization in Python: Attack Techniques and Secure Coding — redfoxsec.com
  5. Reversing Pickles with r2pickledec — blog.doyensec.com
  6. Ultralytics AI Library Hacked via GitHub for Cryptomining — wiz.io
  7. Three’s a Crowd: TeamPCP trojanizes LiteLLM in Continuation of Campaign — wiz.io
  8. How a Poisoned Security Scanner Became the Key to Backdooring LiteLLM — snyk.io
  9. durabletask: TeamPCP's Latest PyPi Compromise — wiz.io
  10. Microsoft's durabletask package on PyPi Compromised. Mini Shai Hulud attacks again... again! — aikido.dev
  11. JDownloader Website Supply Chain Attack: Installers Replaced with Python RAT Malware (May 2026) — rescana.com
  12. Bootstrap script exposes PyPI to domain takeover attacks — reversinglabs.com
  13. Script Injection and Data Theft: Python Data Analysis Tool Compromised — heise.de
  14. Code injection in Python: examples and prevention — snyk.io
  15. Command injection in Python: examples and prevention — snyk.io
  16. The subprocess Module: Wrapping Programs With Python — realpython.com
  17. Breaking the AWS MCP Python Sandbox — xplo1t-sec.github.io
  18. Known Unpatched Exploitable: Redashs Python Sandbox Escape Gives Attackers Full Server Access — ox.security
  19. Server-Side Template Injection to RCE in a Lab — 0xpriv.dev
  20. H7CTF 2026 Merged: Jinja2 SSTI filter bypass — 0x3n1ty.github.io
  21. Understanding and mitigating the Jinja2 XSS vulnerability (CVE-2024-22195) — snyk.io
  22. ZDI-26-816 Ultralytics load_dataset_cache_file deserialization RCE — zerodayinitiative.com
  23. Xoscar unauthenticated RCE through actor message deserialization — github.com
  24. Serena RCE via insecure pickle deserialization of LSP symbol cache — github.com
  25. Leaking internal headers in Flask Ninja with deserialization — eval.blog
  26. CVE-2026-21226: Azure Core Python Library RCE Vulnerability — sentinelone.com
  27. CVE-2025-68664: Critical LangChain Flaw Enables Secret Extraction — socradar.io
  28. CVE-2026-22607: Fickling Python RCE Vulnerability — sentinelone.com
  29. CVE-2025-56005: PLY RCE Vulnerability — sentinelone.com
  30. RCE With Modern AI/ML Formats and Python Libraries — unit42.paloaltonetworks.com
  31. Rapid Exploitation and Clever Malware in the Supply Chain — Last Week in AppSec — checkmarx.com
  32. CrewAI contains multiple vulnerabilities including SSRF, RCE — kb.cert.org
  33. CVE-2026-33873: Langflow Agentic Assistant RCE Vulnerability — sentinelone.com
  34. How I Found a High-Severity Directory Traversal in Flask-Admin — infosecwriteups.com
  35. Python Software Foundation - Python 3.11.0a3 to 3.15.0b2 — bishopfox.com
  36. Linux Kernel Elevation of Privilege Vulnerability — hkcert.org
  37. "Copy Fail": Linux root in all major distributions with 732 bytes of Python — heise.de
  38. New Linux 'Copy Fail' Vulnerability Enables Root Access on Major Distributions — thehackernews.com
  39. BadHost - One character and your AI agent switches sides — korben.info
  40. Marimo RCE Flaw CVE-2026-39987 Exploited Within 10 Hours of Disclosure — thehackernews.com
  41. Malicious PyPI Packages Deliver SilentSync RAT — zscaler.com
  42. Compromised LiteLLM PyPI Package Delivers Credential Stealer — sonatype.com
  43. CVE-2026-34519: AIOHTTP XSS Vulnerability — sentinelone.com
  44. Picklescan Allows RCE via Malicious Pickle File — github.com
  45. Critical PickleScan Vulnerabilities Expose AI Model Supply Chains — infosecurity-magazine.com
  46. Exposing 4 Critical Vulnerabilities in Python PickleScan | Sonatype — sonatype.com
  47. GitHub - WafflesExploits/hide-payload-in-images: A project that demonstrates embedding shellcode payloads into image files (like PNGs) using Python and extracting them using C/C++. Payloads can be retrieved directly from the file on disk or from the image stored in a binary's resources section (.rsrc) — github.com
  48. https://www.thepythoncode.com/article/create-reverse-shell-python — thepythoncode.com
  49. How To Keep A Secret in Python Apps — talkpython.fm
  50. Running Untrusted Python Code — healeycodes.com
  51. Snyk and uv, Better Together — snyk.io
  52. Benchmarking Secure-and-Functional Remediation and How Snyk Agent Fix Lifts Frontier-Model Fix Rates by over 14% — snyk.io
  53. Taming our Python dependencies at Microsoft with AI — microsoft.com
  54. How to secure Python Flask applications — snyk.io
  55. The ultimate guide to creating a secure Python package — snyk.io
  56. Bandit Python: Free SAST in 10 Seconds (2026 Review) — appsecsanta.com
  57. wapiti-scanner/wapiti: Web vulnerability scanner written in Python3 — github.com
  58. A Python prompt into a running process: debugging with Manhole — pythonspeed.com
  59. A Python prompt into a running process: debugging with Manhole — pythonspeed.com
  60. Writing fast async HTTP requests in Python — blog.jonlu.ca
  61. GitHub - apify/crawlee-python: Crawlee—A web scraping and browser automation library for Python to build reliable crawlers. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with BeautifulSoup, Playwright, and raw HTTP. Both headful and headless mode. With proxy rotation. — github.com
  62. SSH Scripting with Fabric and Python - Mouse Vs Python — blog.pythonlibrary.org
  63. Elliptic Curve Keys Python and Hazmat — medium.com
  64. RSA Signatures Python and Hazmat — medium.com
  65. Download and Installation Scapy 2.4.5. documentation — scapy.readthedocs.io
  66. python/scapy DNS sniffer and parser - Stack Overflow — stackoverflow.com
  67. How to Brute-Force SSH Servers in Python — thepythoncode.com
  68. GitHub - danialhalo/SqliSniper: Advanced Time-based Blind SQL Injection fuzzer for HTTP Headers — github.com
  69. GitHub - xnl-h4ck3r/knoxnl: This is a python wrapper around the amazing KNOXSS API by Brute Logic — github.com
  70. GitHub - cle-b/httpdbg: A tool for Python developers to easily debug the HTTP(S) client requests in a Python program. — github.com
  71. How a Poisoned Security Scanner Backdoored LiteLLM — snyk.io
  72. What AI 'fingerprints' helped expose the 1st AI-made zero-day exploit? | The exploit was a Python script — inshorts.com
  73. Shipping post-quantum cryptography to Python — blog.trailofbits.com
  74. Critical SQL Injection Vulnerability in Django (CVE-2025-64459) — endorlabs.com
  75. OWASP Pygoat — owasp.org
📚 This guide is synthesized from the full text of resources curated in the Python library, and refreshed as new material is added.