agentsclimarketplace

Eresus python audit

Skill EresusSecurity/appsec-skills/skills/eresus-python-audit

Deep Python-specific security audit skill with 50+ vulnerability class coverage across 7 categories. Trigger when auditing Python code: "audit this Python app", "find Python security issues", "check Flask/Django for vulnerabilities", "Python SAST review", "check for pickle vulnerabilities", "review this FastAPI code". Covers misconfiguration, injection, crypto, XSS, deserialization, and ML/AI attack surfaces. Includes scripts/rules.json for programmatic rule lookup.From its SKILL.md

Install
npx -y skills add EresusSecurity/appsec-skills --skill eresus-python-audit

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • reads credentialsReads from 1 credential source: `SECRET_KEY`.
  • 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

10.7 KB, ~2.6k tokens by cl100k_base, as published. Nobody here has run it

Python Security Audit

Purpose

Perform a comprehensive, depth-first security audit of Python codebases. This skill provides the complete knowledge of Bandit's 50+ security checks, organized by category and severity, plus framework-specific patterns for Django, Flask, FastAPI, and emerging ML/AI attack surfaces.

Use view_file and grep_search exclusively. No terminal commands.


Audit Workflow

Phase 1: Reconnaissance

  1. Identify the Python framework in use (Django, Flask, FastAPI, Tornado, aiohttp, raw stdlib)
  2. Check requirements.txt / pyproject.toml / Pipfile for dangerous dependencies
  3. Map entry points: URL routes, CLI commands, message consumers, scheduled tasks
  4. Identify configuration files and secrets management approach

Phase 2: Systematic Check — By Category

Work through each category below. For each check, use grep_search to find all instances, then view_file to trace the data flow and confirm exploitability.


B1xx — Miscellaneous Checks

IDNameSeverityWhat to Search
B101assert_usedLowassert statements used for security checks (removed with -O flag)
B102exec_usedMediumexec() calls — trace if input is user-controlled
B103set_bad_file_permissionsMediumos.chmod() with overly permissive modes (0o777, 0o666)
B104hardcoded_bind_all_interfacesMediumBinding to 0.0.0.0 — exposes service on all interfaces
B105hardcoded_password_stringLowStrings assigned to variables named password, secret, key, token
B106hardcoded_password_funcargLowPassword-like strings passed as function arguments
B107hardcoded_password_defaultLowDefault parameter values containing password-like strings
B108hardcoded_tmp_directoryLowHardcoded /tmp paths — race conditions, symlink attacks
B109password_config_option_not_marked_secretLowConfig options with password/secret that aren't marked as sensitive
B110try_except_passLowexcept: pass — silently swallowing errors including security exceptions
B111execute_with_run_as_root_equals_trueMediumFunctions called with run_as_root=True
B112try_except_continueLowexcept: continue — same problem as B110
B113request_without_timeoutMediumrequests.get/post() without timeout= parameter — DoS via hang

Audit Depth for B1xx

  • B101: Check if assert guards authentication or authorization. If so, HIGH severity.
  • B102: Trace exec() input — if user-controlled, escalate to CRITICAL (RCE).
  • B105/106/107: Check if the hardcoded credentials are for production systems or test fixtures.
  • B113: Check all HTTP client calls (requests, httpx, urllib3, aiohttp) for timeout.

B2xx — Application/Framework Misconfiguration

IDNameSeverityWhat to Search
B201flask_debug_trueHighapp.run(debug=True) — enables Werkzeug debugger (RCE)
B202tarfile_unsafe_membersHightarfile.extractall() without filter= — path traversal via tar

Audit Depth for B2xx

  • B201: Check if debug=True is conditional on environment or always on. Check for WERKZEUG_DEBUG_PIN.
  • B202: Any tarfile.open() + extractall() from user-uploaded files = CRITICAL path traversal.

B3xx — Dangerous Function Calls (Blacklists)

IDNameSeverityWhat to Search
B324hashlibMediumUse of md5(), sha1() for security-sensitive operations (password hashing, integrity)

Extended B3xx Checks (Eresus additions)

  • hashlib.md5() / hashlib.sha1() for password storage → escalate to HIGH
  • Use of random module instead of secrets for security tokens → HIGH
  • string.Template with user input → potential template injection

B5xx — Cryptography

IDNameSeverityWhat to Search
B501request_with_no_cert_validationHighrequests.get(url, verify=False) — TLS downgrade
B502ssl_with_bad_versionHighssl.SSLContext(ssl.PROTOCOL_SSLv2) or SSLv3
B503ssl_with_bad_defaultsMediumSSLContext with insecure default protocol
B504ssl_with_no_versionMediumSSLContext created without explicit protocol
B505weak_cryptographic_keyHighRSA < 2048 bits, DSA < 2048 bits, EC < 224 bits
B506yaml_loadMediumyaml.load() without Loader=SafeLoader — deserialization RCE
B507ssh_no_host_key_verificationHighParamiko set_missing_host_key_policy(AutoAddPolicy)
B508snmp_insecure_versionMediumSNMPv1/v2 without authentication
B509snmp_weak_cryptographyMediumSNMPv3 with weak crypto

Audit Depth for B5xx

  • B501: Check if cert pinning is used. If verify=False is in production code → CRITICAL.
  • B506: This is a deserialization sink. If input comes from HTTP/file upload → CRITICAL RCE.

B6xx — Injection

IDNameSeverityWhat to Search
B601paramiko_callsMediumParamiko SSH command execution — trace if command is user-controlled
B602subprocess_popen_with_shell_equals_trueHighsubprocess.Popen(cmd, shell=True) — command injection
B603subprocess_without_shell_equals_trueLowsubprocess.Popen(cmd) without shell — still check input
B604any_other_function_with_shell_equals_trueMediumAny function with shell=True parameter
B605start_process_with_a_shellHighos.system(), os.popen() — command injection
B606start_process_with_no_shellLowos.execl(), os.execve() — still trace input
B607start_process_with_partial_pathLowProcess started without full path — PATH hijacking
B608hardcoded_sql_expressionsMediumSQL strings built with + or % or f-strings
B609linux_commands_wildcard_injectionHighCommands with * glob — wildcard injection (tar, chown, etc.)
B610django_extra_usedMediumDjango QuerySet.extra() — raw SQL injection
B611django_rawsql_usedMediumDjango RawSQL() — raw SQL injection
B612logging_config_insecure_listenMediumlogging.config.listen() — arbitrary code execution
B613trojansourceHighUnicode bidirectional control characters — trojan source attack
B614pytorch_loadHightorch.load() — uses pickle internally, RCE if untrusted
B615huggingface_unsafe_downloadHighHuggingFace model downloads without safety checks

Audit Depth for B6xx

  • B602/B605: Trace the command string backwards. If ANY part is user-controlled → CRITICAL RCE.
  • B608: Check if the SQL is parameterized elsewhere. Raw f-string SQL = HIGH SQLi.
  • B609: tar cf archive.tar * in /tmp with user-created files → argument injection.
  • B614: torch.load() from user-uploaded model file → CRITICAL RCE via pickle.
  • B615: ML model supply chain attack — check if trust_remote_code=True.

B7xx — XSS / Template Injection

IDNameSeverityWhat to Search
B701jinja2_autoescape_falseHighjinja2.Environment(autoescape=False) — stored/reflected XSS
B702use_of_mako_templatesMediumMako templates — no auto-escaping by default
B703django_mark_safeMediummark_safe(user_input) — bypasses Django auto-escaping
B704markupsafe_markup_xssMediumMarkup(user_input) — bypasses escaping

Audit Depth for B7xx

  • B701: If autoescape=False and template renders user input → CRITICAL XSS.
  • B703: Trace what data is passed to mark_safe(). If user-controlled → HIGH XSS.

Framework-Specific Deep Checks

Django

  • Check ALLOWED_HOSTS configuration (empty = open redirect)
  • Check CSRF_COOKIE_HTTPONLY, SESSION_COOKIE_SECURE, SECURE_BROWSER_XSS_FILTER
  • Check for @csrf_exempt decorators on sensitive views
  • Check DEBUG = True in production settings
  • Check SECRET_KEY hardcoded or in version control
  • Check MIDDLEWARE ordering (SecurityMiddleware should be first)
  • Check AUTH_PASSWORD_VALIDATORS configuration

Flask

  • Check SECRET_KEY generation (must be cryptographically random)
  • Check app.run(debug=True) in production
  • Check for @app.before_request authentication enforcement
  • Check session cookie configuration (SESSION_COOKIE_SECURE, SESSION_COOKIE_HTTPONLY)
  • Check file upload handling (werkzeug.utils.secure_filename)

FastAPI

  • Check for missing input validation (Body(), Query(), Path() without constraints)
  • Check CORS configuration (allow_origins=["*"])
  • Check authentication dependency injection (missing Depends())
  • Check FileResponse / StreamingResponse path traversal
  • Check OAuth2 implementation (token validation, scope enforcement)

ML/AI Attack Surface

  • torch.load() — pickle-based, RCE from untrusted models
  • transformers.pipeline(trust_remote_code=True) — arbitrary code execution
  • pickle.loads() in model serialization pipelines
  • Prompt injection in LLM-based applications
  • Model poisoning via untrusted training data

Severity Matrix

Confidence \ SeverityLOWMEDIUMHIGH
HIGHInfoMediumCritical
MEDIUMLowMediumHigh
LOWInfoLowMedium

Report Format

For each finding, report:

### [B-ID]: [Check Name]

**Severity**: [LOW/MEDIUM/HIGH/CRITICAL]
**Confidence**: [LOW/MEDIUM/HIGH]
**File**: [path]:[line]

**Vulnerable Code**:
[show the code]

**Data Flow**:
[source] → [intermediaries] → [sink]

**Impact**: [what an attacker achieves]
**Remediation**: [specific fix with code example]
**Bandit Reference**: B[xxx]

Tooling Constraints

Use ONLY:

  • view_file — read source code
  • grep_search — find patterns across the codebase

Do NOT use any terminal commands.

What ships with it: 1 file

10.1 KB alongside SKILL.md

scripts/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.