Skip to content

Scanner Rules

Saeed Yari edited this page Dec 1, 2026 · 1 revision

Scanner Rules

Every check the scanners run, with its OWASP ASVS 5.0.0 requirement and CWE. The tables mirror the README.

The scanners are line-based heuristics: fast, offline and language-agnostic, but blind to data flow. Treat findings as leads for review, not proof, and expect the occasional false positive in code that defines security primitives (for example a crypto library).

Code (scan_code_for_security_issues, and source and config files in audit_directory):

Issue ASVS CWE
SQL built from strings V1.2.4 CWE-89
OS command built from strings or run through a shell V1.2.5 CWE-78
eval, exec, new Function, expression languages on non-literal input V1.3.2 CWE-95
Server-side template built from a non-literal string V1.3.7 CWE-1336
Unsafe deserialization (pickle, yaml.load, ObjectInputStream, unserialize, BinaryFormatter, ...) V1.5.2 CWE-502
XML parser resolving external entities or DTDs V1.5.1 CWE-611
HTML sinks (innerHTML, document.write, dangerouslySetInnerHTML, v-html, ...) without sanitizing V3.2.2 CWE-79
Cookies without Secure / HttpOnly V3.3.1 / V3.3.4 CWE-614 / CWE-1004
CORS allowing any origin / reflecting the Origin V3.4.2 CWE-942
File paths built from request input V5.3.2 CWE-22
JWT signature not verified / none algorithm allowed V9.1.1 / V9.1.2 CWE-347
ECB mode (including Java's "AES" default) and RSA PKCS#1 v1.5 encryption V11.3.1 CWE-327 / CWE-780
DES, 3DES, RC4 V11.3.2 CWE-327
MD5 or SHA-1 / passwords hashed with a fast hash V11.4.1 / V11.4.2 CWE-328 / CWE-916
Non-cryptographic RNG for tokens, passwords, OTPs, salts or session IDs V11.5.1 CWE-338
Weak ciphers or hashes in TLS settings V12.1.2 CWE-327
TLS certificate or hostname verification disabled V12.3.2 CWE-295
Default passwords / hardcoded secrets, keys and connection-string passwords V13.2.3 / V13.3.1 CWE-1392 / CWE-798, CWE-321
Debug mode or detailed error output on V13.4.2 CWE-489
Passwords, tokens or session IDs written to logs V16.2.5 CWE-532

HTTP headers and nginx (audit_http_security_headers, and nginx files in audit_directory):

Issue ASVS CWE
Cookie without Secure or a __Host-/__Secure- prefix; without SameSite; session cookie without HttpOnly V3.3.1, V3.3.2, V3.3.4 CWE-614, CWE-1275, CWE-1004
HSTS missing, shorter than a year, or without includeSubDomains V3.4.1 CWE-319
CORS *, null or a reflected origin V3.4.2 CWE-942
CSP missing or report-only; unsafe-inline, unsafe-eval or broad script sources; no object-src 'none' or base-uri V3.4.3 CWE-693, CWE-79, CWE-95
nosniff missing / Referrer-Policy missing or leaky V3.4.4 / V3.4.5 CWE-693 / CWE-200
No CSP frame-ancestors (X-Frame-Options alone is obsolete) V3.4.6 CWE-1021
No CSP reporting / HTML without Cross-Origin-Opener-Policy V3.4.7 / V3.4.8 CWE-778 / CWE-1022
Outdated TLS protocols / weak cipher suites (nginx) V12.1.1 / V12.1.2 CWE-326 / CWE-327
Plain HTTP without a redirect to HTTPS (nginx) V12.2.1 CWE-319
Directory listing (autoindex on) V13.4.3 CWE-548
Version disclosure (Server version, X-Powered-By, server_tokens) V13.4.6 CWE-200

What triggers a rule, and what does not

Examples from the test suite. Each rule has a test that triggers it and one that must stay quiet.

Rule Flagged Not flagged
SQL injection (V1.2.4) cur.execute(f"SELECT * FROM users WHERE id = {uid}") cur.execute("SELECT * FROM users WHERE id = %s", (uid,))
OS command (V1.2.5) subprocess.run(cmd, shell=True) subprocess.run(["convert", path, "out.png"])
Dynamic code (V1.3.2) result = eval(expression) value = ast.literal_eval(text), model.eval()
Template injection (V1.3.7) render_template_string(f"Hello {name}") render_template("index.html", name=name)
Deserialization (V1.5.2) cfg = yaml.load(stream) cfg = yaml.load(stream, Loader=yaml.SafeLoader)
DOM XSS (V3.2.2) el.innerHTML = comment.body el.innerHTML = DOMPurify.sanitize(html), el.innerHTML = ""
Path traversal (V5.3.2) open(request.args["file"]) send_from_directory(UPLOADS, request.args["file"])
TLS verification (V12.3.2) requests.get(url, verify=False) requests.get(url, verify='/etc/ssl/internal-ca.pem')
JWT signature (V9.1.1, V9.1.2) jwt.decode(tok, options={"verify_signature": False}) jwt.decode(tok, key, algorithms=["RS256"])
Randomness (V11.5.1) reset_token = random.randint(100000, 999999) token = secrets.token_urlsafe(32), delay = random.uniform(0.1, 0.5)
Weak hash (V11.4.1, V11.4.2) hashlib.sha256(password.encode()) hashlib.pbkdf2_hmac("sha256", password, salt, 600_000), hashlib.md5(body, usedforsecurity=False)
RSA padding (V11.3.1) public_key.encrypt(data, padding.PKCS1v15()) key.sign(msg, padding.PKCS1v15(), hashes.SHA256())
Cookie flags (V3.3.1, V3.3.4) resp.set_cookie("session", sid) resp.set_cookie("session", sid, secure=True, httponly=True), jar.set_cookie(cookie)
Secrets (V13.3.1) DB_PASSWORD = "S3cr3t-Pa55word!" password = os.environ["DB_PASSWORD"], api_key = "${API_KEY}"
Debug mode (V13.4.2) DEBUG = True DEBUG = os.environ.get('DEBUG') == '1'
Logging secrets (V16.2.5) logger.info("login for %s with %s", user, password) logger.info("password reset requested for %s", user)

Lines that are only comments are skipped, except by the secrets check: secrets are often left in comments.

Severity

Severity Meaning
critical Exposed keys, such as a hardcoded cryptographic key or a private key block
high Directly exploitable weaknesses, such as injection or disabled TLS verification
medium Weaknesses that need more conditions, or hardening gaps
low Defense in depth and informational issues

Limits

  • The checks are line-based. They do not follow data across lines or files, so they miss issues that only data-flow analysis would find, and they cannot tell whether a value comes from a user.
  • Code that implements security primitives itself (a cryptography or TLS library) produces expected hits.
  • For nginx, every add_header in the file counts as one set; nginx's inheritance between server and location blocks is not modeled.
  • With several Content-Security-Policy headers, only the first occurrence of each directive is checked.

Found a false positive or a missed issue? Open a bug report with a synthetic sample.

Clone this wiki locally