ersinkoc/security-check/sc-lang-python
Claude Code and agent skill by ersinkoc/security-check
- community
Checking that the SKILL.md file is still in the repository.
Python-specific security deep scan
Install
npx vskill@latest install ersinkoc/security-check/sc-lang-pythonSKILL.md
The same SKILL.md was published earlier as ersinkoc/security-check/sc-lang-python.
SC: Python Security Deep Scan
Purpose
Detects Python-specific security anti-patterns and language-idiomatic attack vectors across the entire Python ecosystem, including standard library misuse, web framework pitfalls, serialization dangers, cryptographic weaknesses, and supply-chain risks. This skill goes beyond generic vulnerability scanning to identify issues that are unique to Python's dynamic nature, duck typing, and common idioms.
Activation
Activates when Python source files (.py, .pyw, .pyi) are detected in the scan target, or when Python-related configuration files (pyproject.toml, setup.py, setup.cfg, Pipfile, requirements.txt, poetry.lock, tox.ini, pytest.ini, .flake8) are present.
Checklist Reference
References references/python-security-checklist.md for the full enumeration of checks. Each category below maps to one or more checklist items.
Severity Levels
- CRITICAL: Remote code execution, authentication bypass, data exfiltration
- HIGH: SQL injection, SSRF, path traversal, insecure deserialization
- MEDIUM: Weak cryptography, information disclosure, insecure defaults
- LOW: Best-practice violations, minor information leaks, code quality
Python-Specific Vulnerability Patterns
1. Pickle Deserialization RCE
Description: Python's pickle module can deserialize arbitrary objects, including those with __reduce__ methods that execute arbitrary code. An attacker who controls pickled input can achieve full remote code execution.
Dangerous Functions:
pickle.loads(),pickle.load()pickle.Unpickler().load()cPickle.loads(),cPickle.load()joblib.load()(uses pickle internally)torch.load()(uses pickle internally)numpy.load(allow_pickle=True)
Safe Alternative: Use json, msgpack, or protocol buffers for data interchange. If pickle is absolutely required, use hmac to sign pickled data and verify before loading, or use fickling to audit pickle files.
Vulnerable Code:
Safe Code:
Severity: CRITICAL
2. YAML Unsafe Loading
Description: yaml.load() without a safe Loader can instantiate arbitrary Python objects via YAML tags like !!python/object/apply:os.system. This is equivalent to pickle deserialization in risk.
Dangerous Functions:
yaml.load(data)(no Loader argument)yaml.load(data, Loader=yaml.FullLoader)(partially restricted but still dangerous)yaml.load(data, Loader=yaml.UnsafeLoader)
Safe Alternative: Always use yaml.safe_load() or yaml.load(data, Loader=yaml.SafeLoader).
Vulnerable Code:
Safe Code:
Severity: CRITICAL
3. eval(), exec(), compile() Code Injection
Description: These built-in functions execute arbitrary Python code from strings. When user input reaches them, attackers can execute any code with the privileges of the running process.
Dangerous Functions:
eval()exec()compile()followed byexec()execfile()(Python 2)input()in Python 2 (calls eval internally)
Safe Alternative: Use ast.literal_eval() for parsing literal expressions. For math, use a dedicated parser. For configuration, use JSON or TOML.
Vulnerable Code:
Safe Code:
Severity: CRITICAL
4. Subprocess Shell Injection
Description: Using shell=True with subprocess or calling os.system() / os.popen() passes commands through the system shell, enabling shell metacharacter injection. Attackers can chain commands with ;, |, &&, backticks, or $().
Dangerous Functions:
subprocess.call(cmd, shell=True)subprocess.Popen(cmd, shell=True)subprocess.run(cmd, shell=True)os.system(cmd)os.popen(cmd)commands.getoutput(cmd)(Python 2)
Safe Alternative: Pass commands as a list without shell=True. Use shlex.quote() if shell is absolutely required.
Vulnerable Code:
Safe Code:
Severity: CRITICAL
5. Django ORM raw() and extra() SQL Injection
Description: Django's ORM provides raw() and extra() methods that accept raw SQL strings. String formatting or concatenation in these methods bypasses Django's built-in SQL injection protections.
Dangerous Functions:
Model.objects.raw(f"SELECT * FROM t WHERE id = {user_input}")Model.objects.extra(where=[f"id = {user_input}"])cursor.execute(f"SELECT ... {user_input}")RawSQL()with unparameterized input
Safe Alternative: Use Django ORM's parameterized queries or pass parameters as the second argument to raw().
Vulnerable Code:
Safe Code:
Severity: HIGH
6. Django Security Misconfigurations
Description: Django has many security-related settings that, when misconfigured, open the application to CSRF bypass, XSS, clickjacking, and information disclosure.
Dangerous Patterns:
DEBUG = Truein productionSECRET_KEYhardcoded or in version controlALLOWED_HOSTS = ['*']CSRF_COOKIE_SECURE = False/SESSION_COOKIE_SECURE = FalseSECURE_SSL_REDIRECT = Falsein productionX_FRAME_OPTIONSnot set to'DENY'SECURE_HSTS_SECONDS = 0- Missing
django.middleware.csrf.CsrfViewMiddlewarein MIDDLEWARE - Template injection via
mark_safe()or|safefilter on user data @csrf_exempton sensitive views
Safe Configuration:
Severity: HIGH (DEBUG/SECRET_KEY), MEDIUM (cookie settings)
7. Flask / Jinja2 Server-Side Template Injection (SSTI)
Description: Rendering user-controlled strings as Jinja2 templates allows attackers to access Python internals via the MRO chain (__class__.__mro__), read files, or execute commands.
Dangerous Functions:
Template(user_input).render()render_template_string(user_input)Environment().from_string(user_input).render()
Safe Alternative: Never pass user input as the template itself. Pass it as a variable to a predefined template.
Vulnerable Code:
Safe Code:
Severity: CRITICAL
8. Flask Debug Mode and Secret Key Exposure
Description: Running Flask with debug=True in production exposes the Werkzeug debugger, which provides an interactive Python console. A weak or default secret_key allows session cookie forgery.
Dangerous Patterns:
app.run(debug=True)in productionapp.secret_key = 'dev'or any hardcoded/guessable keyFLASK_DEBUG=1in environment without restriction- Werkzeug debugger PIN exposed or brute-forceable
Safe Alternative: Use environment variables for configuration and never enable debug mode in production.
Vulnerable Code:
Safe Code:
Severity: CRITICAL (debug mode), HIGH (weak secret key)
9. Requests Library SSL Bypass and SSRF
Description: Disabling SSL verification with verify=False enables man-in-the-middle attacks. Passing user-controlled URLs to requests.get() without validation enables Server-Side Request Forgery (SSRF) to reach internal services, cloud metadata endpoints, or internal network resources.
Dangerous Patterns:
requests.get(url, verify=False)requests.get(user_supplied_url)without URL validationurllib.request.urlopen(user_input)- Accessing
http://169.254.169.254/(cloud metadata) - Accessing
http://localhost:...orhttp://127.0.0.1:...internal services
Safe Alternative: Always verify SSL. Validate and restrict URLs with an allowlist of domains/schemes.
Vulnerable Code:
Safe Code:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sc-lang-python/SKILL.md
Popularity
- Repository stars
- 46
- Repository forks
- 5
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ersinkoc/security-check/sc-lang-python)