4097 lines
242 KiB
JSON
4097 lines
242 KiB
JSON
{
|
||
"schema_version": 1,
|
||
"ruleset": "2026-10-09.2",
|
||
"rules": [
|
||
{
|
||
"id": "PY-EVAL",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Executing text as Python",
|
||
"before": "eval(payload)",
|
||
"after": "import json\nvalue = json.loads(payload)\nif not isinstance(value, dict):\n raise ValueError('object required')",
|
||
"fix": "Use JSON plus a schema for data, or a limited parser for a DSL; do not move code into another eval.",
|
||
"check": "Valid documents parse, Python expressions are not executed, and input size is bounded.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-eval",
|
||
"reason": "Review signal: Executing text as Python. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-94"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-SHELL",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Python shell execution",
|
||
"before": "import subprocess\nsubprocess.run(command, shell=True)",
|
||
"after": "import subprocess\nsubprocess.run(['/usr/bin/file', '--', filename], shell=False, check=True, timeout=3)",
|
||
"fix": "Use a fixed executable and separate argv without a shell; allowlist arguments according to the utility contract.",
|
||
"check": "Metacharacters remain data, dangerous options fail, and normal operations work.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-shell",
|
||
"reason": "Review signal: Python shell execution. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: explicit shell=True or inline **dict, shell helpers and literal shell argv in subprocess/asyncio.create_subprocess_exec. Variable argv, wrappers and complex branching are not evaluated.",
|
||
"limitations": "AST: explicit shell=True or inline **dict, shell helpers and literal shell argv in subprocess/asyncio.create_subprocess_exec. Variable argv, wrappers and complex branching are not evaluated.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-DESERIALIZE",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Python object deserialization",
|
||
"before": "import pickle\nvalue = pickle.loads(data)",
|
||
"after": "import json\nvalue = json.loads(data) # validate schema",
|
||
"fix": "For pickle-like formats, use schema-validated JSON where compatible and migrate trusted legacy records separately. For NumPy retain numeric .npy/.npz with allow_pickle=False, dtype/shape and size checks; migrate object arrays separately. Never load an untrusted pickle to convert it.",
|
||
"check": "Valid records remain readable; unknown fields/types and object arrays fail; dtype, shape and volume are checked.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-deserialize",
|
||
"reason": "Review signal: Python object deserialization. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: pickle/dill/shelve, jsonpickle.decode/loads, joblib.load, pandas.read_pickle and direct or simply assigned Unpickler(...).load. numpy.load and numpy.lib.format.read_array require known allow_pickle=True (keyword or third/second positional argument respectively). Import aliases, simple scalar assignments and inline **dict are supported; old defaults, mutable dictionaries, wrappers and data trust need review.",
|
||
"references": [
|
||
"https://jsonpickle.readthedocs.io/en/latest/",
|
||
"https://joblib.readthedocs.io/en/stable/generated/joblib.load.html",
|
||
"https://pandas.pydata.org/docs/reference/api/pandas.read_pickle.html",
|
||
"https://numpy.org/doc/stable/reference/generated/numpy.load.html",
|
||
"https://numpy.org/doc/stable/reference/generated/numpy.lib.format.read_array.html"
|
||
],
|
||
"limitations": "AST: pickle/dill/shelve, jsonpickle.decode/loads, joblib.load, pandas.read_pickle and direct or simply assigned Unpickler(...).load. numpy.load and numpy.lib.format.read_array require known allow_pickle=True (keyword or third/second positional argument respectively). Import aliases, simple scalar assignments and inline **dict are supported; old defaults, mutable dictionaries, wrappers and data trust need review.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-YAML",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "YAML with a potentially unsafe loader",
|
||
"before": "import yaml\nvalue = yaml.load(data, Loader=yaml.Loader)",
|
||
"after": "import yaml\nvalue = yaml.safe_load(data) # validate schema",
|
||
"fix": "Use safe_load, validate fields/types, and bound document size and complexity.",
|
||
"check": "Ordinary YAML works; object tags and unexpected structures fail.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-yaml",
|
||
"reason": "Review signal: YAML with a potentially unsafe loader. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: yaml.load/load_all/unsafe_load/unsafe_load_all, excluding SafeLoader/CSafeLoader/BaseLoader/CBaseLoader, with import aliases, positional Loader and inline **dict. BaseLoader/CBaseLoader return scalars as strings. Review version defaults, wrappers and resource limits.",
|
||
"references": [
|
||
"https://pyyaml.org/wiki/PyYAMLDocumentation"
|
||
],
|
||
"limitations": "AST: yaml.load/load_all/unsafe_load/unsafe_load_all, excluding SafeLoader/CSafeLoader/BaseLoader/CBaseLoader, with import aliases, positional Loader and inline **dict. BaseLoader/CBaseLoader return scalars as strings. Review version defaults, wrappers and resource limits.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-SQL",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "SQL assembled from string expressions",
|
||
"before": "db.execute(\"SELECT id FROM notes WHERE name=%s\" % name)",
|
||
"after": "db.execute(\"SELECT id FROM notes WHERE name=?\", (name,)) # sqlite3",
|
||
"fix": "Bind values using the actual driver's parameter API; select identifiers from a server-side allowlist.",
|
||
"check": "Quotes remain data; ownership restrictions and normal queries remain correct.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-sql",
|
||
"reason": "Review signal: SQL assembled from string expressions. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: string construction at SQL sinks and keywords, including simple assignments. Imported psycopg/psycopg2.sql SQL(nonliteral) or format/join with unknown/raw pieces signal. Literal SQL plus known Identifier/Literal/Placeholder compositions suppress this signal only, not identifier authorization. Mutable composition, wrappers, cross-function flows and driver versions remain manual.",
|
||
"limitations": "AST: string construction at SQL sinks and keywords, including simple assignments. Imported psycopg/psycopg2.sql SQL(nonliteral) or format/join with unknown/raw pieces signal. Literal SQL plus known Identifier/Literal/Placeholder compositions suppress this signal only, not identifier authorization. Mutable composition, wrappers, cross-function flows and driver versions remain manual.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"coverage_required": [
|
||
"python"
|
||
],
|
||
"references": [
|
||
"https://www.psycopg.org/psycopg3/docs/api/sql.html",
|
||
"https://www.psycopg.org/docs/sql.html"
|
||
]
|
||
},
|
||
{
|
||
"id": "PY-ORM-BOOL",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Python and/or used in an ORM expression",
|
||
"before": "User.find(User.name == name and User.password == password)",
|
||
"after": "User.find(User.name == name, User.password == password) # Beanie",
|
||
"fix": "Use the ORM's documented expression composition, not Python short-circuit operators; retain all ownership/authentication predicates.",
|
||
"check": "Both predicates appear in the actual query; wrong passwords and other users' objects fail.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-orm-bool",
|
||
"reason": "Review signal: Python and/or used in an ORM expression. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-TEMPLATE",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Dynamic template source",
|
||
"before": "render_template_string(user_text)",
|
||
"after": "render_template('message.html', message=user_text)",
|
||
"fix": "Keep template source trusted and pass untrusted values as parameters; review autoescape and loader boundaries.",
|
||
"check": "Template syntax in a user field stays data; expected formatting is preserved.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-template",
|
||
"reason": "Review signal: Dynamic template source. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: render_template_string/from_string by method name, first argument or source=, import aliases and inline **dict. Nonliteral source requires review; custom same-named methods may match. Review dictionary variables, wrappers, environment type, trust and autoescape.",
|
||
"references": [
|
||
"https://flask.palletsprojects.com/en/stable/api/#flask.render_template_string",
|
||
"https://jinja.palletsprojects.com/en/stable/api/#jinja2.Environment.from_string"
|
||
],
|
||
"limitations": "AST: render_template_string/from_string by method name, first argument or source=, import aliases and inline **dict. Nonliteral source requires review; custom same-named methods may match. Review dictionary variables, wrappers, environment type, trust and autoescape.",
|
||
"family": "injection",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-TLS",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Python TLS verification disabled",
|
||
"before": "import requests\nrequests.get(url, verify=False)",
|
||
"after": "import requests\nrequests.get(url, verify=True, timeout=3)",
|
||
"fix": "Enable certificate/hostname checks and configure the trusted CA instead of bypassing verification.",
|
||
"check": "Correct CA/hostname works; invalid, expired or wrong-host certificates fail without fallback.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-tls",
|
||
"reason": "Review signal: Python TLS verification disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: verify=False, simple local scalar or inline **dict, respecting overwrite order. Known requests Session/session and httpx Client/AsyncClient with matching with/async with, Session.send and httpx.stream are supported. Generic get/post/put/patch/delete/request remains an untyped heuristic. Dictionary variables, client properties, runtime config and wrappers are not evaluated.",
|
||
"references": [
|
||
"https://requests.readthedocs.io/en/latest/user/advanced/",
|
||
"https://www.python-httpx.org/api/"
|
||
],
|
||
"limitations": "AST: verify=False, simple local scalar or inline **dict, respecting overwrite order. Known requests Session/session and httpx Client/AsyncClient with matching with/async with, Session.send and httpx.stream are supported. Generic get/post/put/patch/delete/request remains an untyped heuristic. Dictionary variables, client properties, runtime config and wrappers are not evaluated.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-DEBUG",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Python web debugger enabled",
|
||
"before": "app.run(debug=True)",
|
||
"after": "app.run(debug=False)",
|
||
"fix": "Disable the debugger in the competition runtime and retain private, redacted diagnostics.",
|
||
"check": "Errors expose no interactive console or stack trace; health checks work.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-debug",
|
||
"reason": "Review signal: Python web debugger enabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "AST: explicit debug/use_debugger=True at run/run_simple (legacy name heuristic). Known imported Flask instances: DEBUG=True via config subscript/update/from_mapping or app.debug=True. Inline dictionaries and aliases supported; custom factories, runtime overrides, configuration files and branches remain manual.",
|
||
"family": "information-disclosure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"detection": "AST: explicit debug/use_debugger=True at run/run_simple (legacy name heuristic). Known imported Flask instances: DEBUG=True via config subscript/update/from_mapping or app.debug=True. Inline dictionaries and aliases supported; custom factories, runtime overrides, configuration files and branches remain manual.",
|
||
"coverage_required": [
|
||
"python"
|
||
],
|
||
"references": [
|
||
"https://flask.palletsprojects.com/en/stable/config/"
|
||
]
|
||
},
|
||
{
|
||
"id": "PY-JWT",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "JWT signature verification disabled",
|
||
"before": "import jwt\nclaims = jwt.decode(token, options={'verify_signature': False})",
|
||
"after": "import jwt\nclaims = jwt.decode(token, key, algorithms=['HS256'], audience='service', options={'require': ['exp', 'sub', 'aud']})",
|
||
"fix": "Verify signatures with a trusted key and fixed algorithm policy; validate required claims and values using the installed library version.",
|
||
"check": "Modified, unsigned, expired and wrong-audience tokens fail; valid sessions work.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-jwt",
|
||
"reason": "Review signal: JWT signature verification disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: options.verify_signature=False with inline **kwargs/options and overwrite order. Only jose.jwt.decode and jwt.decode_complete bind fourth positional options; generic jwt.decode is version-ambiguous. Legacy verify=False remains only for generic jwt.decode. Review *args, mutable dictionaries, wrappers and instance settings; explicit positional/keyword duplicates are not treated as executable JWT calls.",
|
||
"references": [
|
||
"https://github.com/mpdavis/python-jose/blob/3.5.0/jose/jwt.py",
|
||
"https://github.com/jpadilla/pyjwt/blob/2.10.1/jwt/api_jwt.py",
|
||
"https://github.com/jpadilla/pyjwt/blob/1.7.1/jwt/api_jwt.py"
|
||
],
|
||
"limitations": "AST: options.verify_signature=False with inline **kwargs/options and overwrite order. Only jose.jwt.decode and jwt.decode_complete bind fourth positional options; generic jwt.decode is version-ambiguous. Legacy verify=False remains only for generic jwt.decode. Review *args, mutable dictionaries, wrappers and instance settings; explicit positional/keyword duplicates are not treated as executable JWT calls.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-ARCHIVE",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Archive extraction requires path review",
|
||
"before": "archive.extractall(destination)",
|
||
"after": "archive.extractall(destination, filter='data') # tarfile; check runtime support",
|
||
"fix": "Validate paths, links, member types and quotas; use tarfile's data filter where supported. A filter is not a resource limit or a complete ZIP policy.",
|
||
"check": "Traversal, links, device entries and oversized archives fail; ordinary archives remain inside the root.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-archive",
|
||
"reason": "Review signal: Archive extraction requires path review. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: any extractall is a heuristic including ZIP; extract requires known tarfile.open/TarFile/TarFile.open through aliases, constructors, simple assignment or with/as. shutil.unpack_archive requires known tar/gztar/bztar/xztar/zstdtar format, including third argument. filter='data' or tarfile.data_filter (aliases/inline **dict included) suppresses this signal, not all risks. Review custom filters, extension-inferred format, extraction_filter, versions, quotas, wrappers and complex control flow.",
|
||
"references": [
|
||
"https://docs.python.org/3/library/tarfile.html#extraction-filters",
|
||
"https://docs.python.org/3/library/shutil.html#shutil.unpack_archive",
|
||
"https://peps.python.org/pep-0706/"
|
||
],
|
||
"limitations": "AST: any extractall is a heuristic including ZIP; extract requires known tarfile.open/TarFile/TarFile.open through aliases, constructors, simple assignment or with/as. shutil.unpack_archive requires known tar/gztar/bztar/xztar/zstdtar format, including third argument. filter='data' or tarfile.data_filter (aliases/inline **dict included) suppresses this signal, not all risks. Review custom filters, extension-inferred format, extraction_filter, versions, quotas, wrappers and complex control flow.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-22"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-TEMP",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Non-atomic temporary filename",
|
||
"before": "import tempfile\nname = tempfile.mktemp()",
|
||
"after": "import tempfile\nwith tempfile.TemporaryFile() as output:\n output.write(data)",
|
||
"fix": "Create a private temporary file atomically and retain its handle; never reopen an untrusted name.",
|
||
"check": "Concurrent requests obtain separate files and cannot overwrite existing files or links.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-temp",
|
||
"reason": "Review signal: Non-atomic temporary filename. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "file-access",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-XML",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "XML entity resolution enabled",
|
||
"before": "parser = etree.XMLParser(resolve_entities=True)",
|
||
"after": "parser = etree.XMLParser(resolve_entities=False, load_dtd=False, no_network=True)",
|
||
"fix": "Disable entity/DTD loading and network access; bound document complexity for the actual parser.",
|
||
"check": "Ordinary XML parses; external resources are not read and oversized input fails.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-xml",
|
||
"reason": "Review signal: XML entity resolution enabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: XMLParser by method name; lxml.etree.XMLPullParser/ETCompatXMLParser/iterparse by resolved import name/alias. Requires known resolve_entities=True, including scalar variables or inline **dict. Review defaults, lxml version, DTD, input type and wrappers. This does not determine CVE applicability.",
|
||
"references": [
|
||
"https://github.com/lxml/lxml/security/advisories/GHSA-vfmq-68hx-4jfw"
|
||
],
|
||
"limitations": "AST: XMLParser by method name; lxml.etree.XMLPullParser/ETCompatXMLParser/iterparse by resolved import name/alias. Requires known resolve_entities=True, including scalar variables or inline **dict. Review defaults, lxml version, DTD, input type and wrappers. This does not determine CVE applicability.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-611"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-WEAK-HASH",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "MD5/SHA1: review the purpose",
|
||
"before": "import hashlib\ndigest = hashlib.md5(password)",
|
||
"after": "import hashlib\ndigest = hashlib.scrypt(password, salt=salt, n=16384, r=8, p=1)",
|
||
"fix": "Use a supported password KDF for passwords and HMAC/signatures for authenticity; ordinary checksums need a separate decision.",
|
||
"check": "Authentication checks work and legacy data has a migration path.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-weak-hash",
|
||
"reason": "Review signal: MD5/SHA1: review the purpose. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-RNG",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Non-cryptographic randomness near a possible secret",
|
||
"before": "import random\ntoken = str(random.getrandbits(128))",
|
||
"after": "import secrets\ntoken = secrets.token_urlsafe(32)",
|
||
"fix": "Use secrets or a supported CSPRNG with sufficient entropy for tokens; handle generator errors.",
|
||
"check": "No predictable fallback is used; token format and sessions stay compatible.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-rng",
|
||
"reason": "Review signal: Non-cryptographic randomness near a possible secret. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-FILE",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Dynamic file-serving path",
|
||
"before": "result = send_file(user_path)",
|
||
"after": "record = load_owned_file(file_id, current_user.id)\nresult = send_file(record.storage_path)",
|
||
"fix": "Resolve a server-owned record after authorization and enforce the storage root; review symlinks and races.",
|
||
"check": "Other owners' files, traversal and external symlinks fail; authorized downloads work.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-file",
|
||
"reason": "Review signal: Dynamic file-serving path. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"review_after": true,
|
||
"detection": "AST: send_file by method name, first argument or path_or_file= with aliases/inline **dict. Nonliteral paths still signal after safe owned-record lookup; custom same-named methods may match. Review authorization, root, links, wrappers and dictionary variables.",
|
||
"references": [
|
||
"https://flask.palletsprojects.com/en/stable/api/#flask.send_file"
|
||
],
|
||
"limitations": "AST: send_file by method name, first argument or path_or_file= with aliases/inline **dict. Nonliteral paths still signal after safe owned-record lookup; custom same-named methods may match. Review authorization, root, links, wrappers and dictionary variables.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-22"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-URL",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Dynamic outbound URL",
|
||
"before": "import requests\nresponse = requests.get(user_url)",
|
||
"after": "import requests\nresponse = requests.get('https://api.example.invalid/status', timeout=3, allow_redirects=False)",
|
||
"fix": "Apply explicit destination/scheme/port policy, validate resolved addresses and every redirect, and bound time/response size.",
|
||
"check": "Approved endpoints work; forbidden destinations and redirects cannot cross the trust boundary.",
|
||
"engine": "python-ast",
|
||
"doc": "docs/vulnerabilities/python.md#py-url",
|
||
"reason": "Review signal: Dynamic outbound URL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: requests/httpx/urlopen and known Session/session, requests.sessions.Session/session, Client/AsyncClient via aliases, local assignment or immediate constructor. with/as supports requests Session/httpx Client and async with/as supports AsyncClient; facts are invalidated after the region. request(method,url), httpx.stream and Client/AsyncClient.stream use second argument or url=. Literal URLs do not signal. No URL/DNS/redirect validation analysis; review wrappers, returned clients, mutable config and complex relationships.",
|
||
"references": [
|
||
"https://requests.readthedocs.io/en/latest/user/advanced/",
|
||
"https://www.python-httpx.org/async/",
|
||
"https://www.python-httpx.org/api/"
|
||
],
|
||
"limitations": "AST: requests/httpx/urlopen and known Session/session, requests.sessions.Session/session, Client/AsyncClient via aliases, local assignment or immediate constructor. with/as supports requests Session/httpx Client and async with/as supports AsyncClient; facts are invalidated after the region. request(method,url), httpx.stream and Client/AsyncClient.stream use second argument or url=. Literal URLs do not signal. No URL/DNS/redirect validation analysis; review wrappers, returned clients, mutable config and complex relationships.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-SHELL",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Node.js shell API",
|
||
"before": "child_process.exec(command);",
|
||
"after": "child_process.execFile('/usr/bin/file', ['--', filename], {timeout: 3000}, callback);",
|
||
"fix": "Use a fixed executable and separate argv with validated options and bounded execution.",
|
||
"check": "Metacharacters stay data; dangerous options fail; normal commands work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-shell",
|
||
"reason": "Review signal: Node.js shell API. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "(?<![\\w$.])(?:exec|execSync)\\s*\\(|\\b(?:child_process|childProcess|cp)\\s*\\.\\s*(?:exec|execSync)\\s*\\(|\\bshell[\"\\']?\\s*[:=]\\s*(?:true\\b|[\"\\'][^\"\\'\\n]{1,180}[\"\\'])|\\b(?:spawn|spawnSync|execFile|execFileSync)\\s*\\(\\s*[\"\\'](?:[^\"\\'\\n]*/)?(?:sh|bash|dash|zsh|cmd(?:\\.exe)?|powershell(?:\\.exe)?|pwsh)[\"\\']",
|
||
"detection": "Regex: bare exec/execSync, common child_process/cp receivers, shell:true/nonempty shell string and literal shell in spawn/execFile. Static ESM/CommonJS child_process imports support aliases and string bracket access; arbitrary object.exec is not a process call. Import hints are not scope/type/data-flow analysis: comments, shadowing and reassignment may match; review wrappers/dynamic imports.",
|
||
"limitations": "Regex: bare exec/execSync, common child_process/cp receivers, shell:true/nonempty shell string and literal shell in spawn/execFile. Static ESM/CommonJS child_process imports support aliases and string bracket access; arbitrary object.exec is not a process call. Import hints are not scope/type/data-flow analysis: comments, shadowing and reassignment may match; review wrappers/dynamic imports.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-EVAL",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Dynamic JavaScript execution",
|
||
"before": "const value = eval(input);",
|
||
"after": "const value = JSON.parse(input); // validate schema",
|
||
"fix": "Parse schema-validated data or a restricted DSL instead of evaluating JavaScript.",
|
||
"check": "Code-like input stays data; valid input works within limits.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-eval",
|
||
"reason": "Review signal: Dynamic JavaScript execution. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bvm\\.(?:runInNewContext|runInThisContext|runInContext)\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-94"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-SQL",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Dynamic Node.js SQL",
|
||
"before": "db.query(\"SELECT id FROM notes WHERE name=\" + name);",
|
||
"after": "db.query(\"SELECT id FROM notes WHERE name=?\", [name]);",
|
||
"fix": "Use driver-supported bind parameters and allowlist identifiers.",
|
||
"check": "Quotes do not alter query structure; ownership restrictions remain.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-sql",
|
||
"reason": "Review signal: Dynamic Node.js SQL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:query|execute)\\s*\\(\\s*(?:(?:(?:\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\"|'(?:\\\\.|[^'\\\\\\r\\n]){0,500}')\\s*\\+|\\x60[^\\x60]{0,1000}\\$\\{)|\\{[^}]{0,300}\\b(?:text|sql)[\"\\']?\\s*:\\s*(?:(?:\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\"|'(?:\\\\.|[^'\\\\\\r\\n]){0,500}')\\s*\\+|\\x60[^\\x60]{0,1000}\\$\\{))",
|
||
"detection": "Legacy regex with comment/string exclusions: query/execute string construction or text/sql objects (receiver untyped). Bounded tokens also detect direct req/request.body/query/params property as SQL to a default/namespace imported pg Pool/Client or mysql/mysql2 createPool/createConnection binding. Named imports, acquired connections, SQL variables, tagged templates, wrappers and cross-file flows remain manual.",
|
||
"limitations": "Legacy regex with comment/string exclusions: query/execute string construction or text/sql objects (receiver untyped). Bounded tokens also detect direct req/request.body/query/params property as SQL to a default/namespace imported pg Pool/Client or mysql/mysql2 createPool/createConnection binding. Named imports, acquired connections, SQL variables, tagged templates, wrappers and cross-file flows remain manual.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"coverage_required": [
|
||
"javascript"
|
||
],
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "JS-NOSQL",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Request body used as a MongoDB filter",
|
||
"before": "collection.findOne(req.body);",
|
||
"after": "if (typeof req.body.name !== 'string') throw new Error('invalid');\ncollection.findOne({name: req.body.name, ownerId: currentUser.id});",
|
||
"fix": "Validate field types and build a server-owned filter with ownership constraints.",
|
||
"check": "Operator objects and unknown fields cannot widen the query; normal lookups work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-nosql",
|
||
"reason": "Review signal: Request body used as a MongoDB filter. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:find|findOne|findOneAndUpdate|deleteMany|updateMany)\\s*\\(\\s*(?:req|request)\\.(?:body|query)\\s*[,)]",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-MASS-ASSIGN",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Mass assignment",
|
||
"before": "Object.assign(user, req.body);",
|
||
"after": "user.displayName = validateName(req.body.displayName);",
|
||
"fix": "Allowlist editable fields; derive owner, role and privileges on the server.",
|
||
"check": "Additional/nested privilege fields fail or are ignored; normal edits work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-mass-assign",
|
||
"reason": "Review signal: Mass assignment. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bObject\\.assign\\s*\\([^;\\n]{0,300},\\s*(?:req|request)\\.body\\b|\\.\\.\\.\\s*(?:req|request)\\.body\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-PROTOTYPE",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Deep merge of an untrusted object",
|
||
"before": "merge(settings, req.body);",
|
||
"after": "settings.theme = validateTheme(req.body.theme);",
|
||
"fix": "Copy only schema-approved fields and reject prototype-related keys at every level.",
|
||
"check": "Nested prototype keys cannot affect unrelated objects; supported settings apply.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-prototype",
|
||
"reason": "Review signal: Deep merge of an untrusted object. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:merge|defaultsDeep|mergeWith)\\s*\\([^;]{0,500}(?:req|request)\\.body",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-TLS",
|
||
"languages": [
|
||
"javascript",
|
||
"config",
|
||
"docker",
|
||
"shell"
|
||
],
|
||
"title": "Node.js TLS verification disabled",
|
||
"before": "const options = {rejectUnauthorized: false};",
|
||
"after": "const options = {rejectUnauthorized: true};",
|
||
"fix": "Enable peer/hostname checks and configure the trusted CA instead of disabling validation globally.",
|
||
"check": "Valid certificates work; wrong CA/hostname and expiry fail.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-tls",
|
||
"reason": "Review signal: Node.js TLS verification disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\brejectUnauthorized[\"\\']?\\s*[:=]\\s*false\\b|\\bNODE_TLS_REJECT_UNAUTHORIZED[\"\\']?\\s*\\]?\\s*[:=]\\s*(?:\"0\"|\\'0\\'|0)(?=[ \\t]*(?:[,;)}\\]\\r\\n]|$|#|//))",
|
||
"detection": "Regex: rejectUnauthorized:false/assignment only in JavaScript/config; NODE_TLS_REJECT_UNAUTHORIZED with exact 0 or paired quotes. Shell KEY=0 ends at whitespace, shell separators or end. Docker covers first ENV KEY=0 or whole-value ENV KEY 0, including paired quotes. 0.1, 0-disabled and quoted whitespace do not match; # or // suffix belongs to the shell/Docker value and semicolon belongs to Docker ENV. Comments/strings may match. Review Docker RUN/later ENV keys, concatenation, expansions, continuations, custom Agent and effective overrides.",
|
||
"references": [
|
||
"https://nodejs.org/api/cli.html#node_tls_reject_unauthorizedvalue",
|
||
"https://github.com/nodejs/node/blob/v22.14.0/lib/internal/options.js",
|
||
"https://docs.docker.com/reference/dockerfile/#env"
|
||
],
|
||
"language_patterns": {
|
||
"shell": "\\bNODE_TLS_REJECT_UNAUTHORIZED=(?:\"0\"|\\'0\\'|0)(?=[ \\t;&|\\r\\n]|$)",
|
||
"docker": "^[ \\t]*ENV[ \\t]+NODE_TLS_REJECT_UNAUTHORIZED=(?:\"0\"|\\'0\\'|0)(?=[ \\t\\r\\n]|$)|^[ \\t]*ENV[ \\t]+NODE_TLS_REJECT_UNAUTHORIZED[ \\t]+(?:\"0\"|\\'0\\'|0)\\r?$"
|
||
},
|
||
"limitations": "Regex: rejectUnauthorized:false/assignment only in JavaScript/config; NODE_TLS_REJECT_UNAUTHORIZED with exact 0 or paired quotes. Shell KEY=0 ends at whitespace, shell separators or end. Docker covers first ENV KEY=0 or whole-value ENV KEY 0, including paired quotes. 0.1, 0-disabled and quoted whitespace do not match; # or // suffix belongs to the shell/Docker value and semicolon belongs to Docker ENV. Comments/strings may match. Review Docker RUN/later ENV keys, concatenation, expansions, continuations, custom Agent and effective overrides.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-HTML",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "HTML output sink",
|
||
"before": "element.innerHTML = message;",
|
||
"after": "element.textContent = message;",
|
||
"fix": "Use textContent for text or a reviewed context-appropriate sanitizer for supported rich HTML.",
|
||
"check": "User markup cannot execute; intended presentation remains usable.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-html",
|
||
"reason": "Review signal: HTML output sink. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\.innerHTML\\s*=|\\bdangerouslySetInnerHTML\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-SQL",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "Dynamic PHP SQL",
|
||
"before": "$db->query(\"SELECT id FROM notes WHERE name=\" . $name);",
|
||
"after": "$stmt = $db->prepare(\"SELECT id FROM notes WHERE name = ?\");\n$stmt->execute([$name]);",
|
||
"fix": "Use driver-supported prepared statements and bound values; allowlist identifiers.",
|
||
"check": "Quotes stay data and ownership conditions remain.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/php.md#php-sql",
|
||
"reason": "Review signal: Dynamic PHP SQL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "(?:->\\s*(?:query|exec|prepare)\\s*\\(\\s*(?:(?:\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\"|'(?:\\\\.|[^'\\\\\\r\\n]){0,500}')\\s*\\.|\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\\$[A-Za-z_{])|\\b(?:mysqli_query|pg_query)\\s*\\(\\s*(?:[^,\\n]{1,120},\\s*)?(?:(?:\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\"|'(?:\\\\.|[^'\\\\\\r\\n]){0,500}')\\s*\\.|\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\\$[A-Za-z_{]))",
|
||
"detection": "Regex: query/exec/prepare with concatenation, double-quoted interpolation and mysqli_query/pg_query with an ordinary connection argument. Escaping, other interpolation and SQL variables are not fully parsed.",
|
||
"limitations": "Regex: query/exec/prepare with concatenation, double-quoted interpolation and mysqli_query/pg_query with an ordinary connection argument. Escaping, other interpolation and SQL variables are not fully parsed.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-OBJECT",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "Untrusted PHP unserialize",
|
||
"before": "$value = unserialize($data);",
|
||
"after": "$value = json_decode($data, true, 32, JSON_THROW_ON_ERROR); // validate schema",
|
||
"fix": "Prefer schema-validated JSON; migrate trusted legacy records separately. allowed_classes alone is not a complete input policy.",
|
||
"check": "Unexpected object types fail without construction; valid records stay readable.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/php.md#php-object",
|
||
"reason": "Review signal: Untrusted PHP unserialize. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bunserialize\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-SHELL",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "PHP code or shell execution",
|
||
"before": "shell_exec($command);",
|
||
"after": "$size = filesize($checkedPath);",
|
||
"fix": "Prefer a library operation; otherwise use a fixed executable and validated argv without a shell.",
|
||
"check": "Metacharacters and dangerous options cannot change the operation.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/php.md#php-shell",
|
||
"reason": "Review signal: PHP code or shell execution. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "(?<![\\w:>])(?:eval|shell_exec|system|passthru|popen)\\s*\\(|(?<![\\w:>])exec\\s*\\(|\\bproc_open\\s*\\((?!\\s*(?:command\\s*:\\s*)?(?:\\[|array\\s*\\())|\\bproc_open\\s*\\(\\s*(?:command\\s*:\\s*)?(?:\\[|array\\s*\\()\\s*[\"\\'](?:[^\"\\'\\n]*/)?(?:sh|bash|dash|zsh|cmd(?:\\.exe)?|powershell(?:\\.exe)?|pwsh)[\"\\']",
|
||
"detection": "Regex: eval/shell_exec/system/passthru/popen/exec and string/variable proc_open. Literal argv arrays in proc_open's first argument (including PHP 8 command:) are excluded unless explicitly launching shell; arrays require PHP 7.4+. Review executable/options, reordered named arguments, backticks, variable functions, wrappers and runtime version. Custom same-named functions/comments may match.",
|
||
"references": [
|
||
"https://www.php.net/manual/en/function.proc-open.php",
|
||
"https://github.com/php/php-src/blob/php-8.0.0/ext/standard/basic_functions.stub.php#L1156",
|
||
"https://github.com/php/doc-en/blob/master/reference/exec/functions/proc-open.xml#L68"
|
||
],
|
||
"limitations": "Regex: eval/shell_exec/system/passthru/popen/exec and string/variable proc_open. Literal argv arrays in proc_open's first argument (including PHP 8 command:) are excluded unless explicitly launching shell; arrays require PHP 7.4+. Review executable/options, reordered named arguments, backticks, variable functions, wrappers and runtime version. Custom same-named functions/comments may match.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-INCLUDE",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "Client-selected include path",
|
||
"before": "include $_GET['page'];",
|
||
"after": "$pages = ['home' => __DIR__ . '/pages/home.php'];\nif (!isset($pages[$page])) { throw new Exception('bad page'); }\ninclude $pages[$page];",
|
||
"fix": "Select server-owned include paths from a closed allowlist, never client paths/URLs.",
|
||
"check": "Only approved pages load; traversal and remote schemes fail.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/php.md#php-include",
|
||
"reason": "Review signal: Client-selected include path. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:include|require)(?:_once)?\\s*\\(?\\s*\\$_(?:GET|POST|REQUEST|COOKIE)\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-22"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-SQL",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "Dynamic Go SQL",
|
||
"before": "db.Query(\"SELECT id FROM notes WHERE name=\" + name)",
|
||
"after": "db.Query(\"SELECT id FROM notes WHERE name=$1\", name)",
|
||
"fix": "Bind values using actual driver placeholders; allowlist identifiers.",
|
||
"check": "Quotes remain values; legitimate queries and ownership checks work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/go.md#go-sql",
|
||
"reason": "Review signal: Dynamic Go SQL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\.(?:(?:Query|QueryRow|Exec|Prepare)\\s*\\(\\s*|(?:Query|QueryRow|Exec|Prepare)Context\\s*\\(\\s*[^,\\n]{1,160},\\s*)(?:fmt\\.Sprintf\\s*\\(|\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\"\\s*\\+)",
|
||
"detection": "Regex: Query/QueryRow/Exec/Prepare and Context forms with concatenation or fmt.Sprintf. Simple context expressions are supported; review complex syntax, fmt aliases and preassembled SQL.",
|
||
"limitations": "Regex: Query/QueryRow/Exec/Prepare and Context forms with concatenation or fmt.Sprintf. Simple context expressions are supported; review complex syntax, fmt aliases and preassembled SQL.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-HASH-SUM",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "Non-empty argument to hash.Sum",
|
||
"before": "digest := h.Sum(record.Hash[:])",
|
||
"after": "h.Write(record.Hash[:])\ndigest := h.Sum(nil)",
|
||
"fix": "Use Write to hash bytes and Sum(nil) for the digest; Sum appends a digest instead of hashing its argument.",
|
||
"check": "Known vectors match; legacy digest formats are migrated deliberately.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/go.md#go-hash-sum",
|
||
"reason": "Review signal: Non-empty argument to hash.Sum. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\.Sum\\s*\\(\\s*(?!nil\\s*\\))[^)\\s][^)]{0,250}\\)",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-HTML",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "Go autoescape bypass",
|
||
"before": "value := template.HTML(input)",
|
||
"after": "value := input // string passed to html/template",
|
||
"fix": "Pass strings to html/template; use trusted HTML only after a reviewed sanitizer if needed.",
|
||
"check": "User tags/quotes render as text; intended formatting works.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/go.md#go-html",
|
||
"reason": "Review signal: Go autoescape bypass. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\btemplate\\.(?:HTML|JS|URL|CSS|HTMLAttr)\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-TLS",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "Go InsecureSkipVerify",
|
||
"before": "cfg := tls.Config{InsecureSkipVerify: true}",
|
||
"after": "cfg := tls.Config{InsecureSkipVerify: false}",
|
||
"fix": "Use normal certificate/hostname verification and the required CA; review custom verification callbacks.",
|
||
"check": "Correct peers work and invalid certificates fail.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/go.md#go-tls",
|
||
"reason": "Review signal: Go InsecureSkipVerify. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bInsecureSkipVerify\\s*:\\s*true\\b|\\.\\s*InsecureSkipVerify\\s*=(?!=)\\s*true\\b",
|
||
"detection": "Regex: InsecureSkipVerify:true and .InsecureSkipVerify=true assignments including newlines; ==, != and false do not match. VerifyConnection does not suppress review: inspect object type, reachability, callback and effective config. Comments/strings may match.",
|
||
"references": [
|
||
"https://pkg.go.dev/crypto/tls#Config"
|
||
],
|
||
"limitations": "Regex: InsecureSkipVerify:true and .InsecureSkipVerify=true assignments including newlines; ==, != and false do not match. VerifyConnection does not suppress review: inspect object type, reachability, callback and effective config. Comments/strings may match.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-OBJECT",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "Java ObjectInputStream",
|
||
"before": "ObjectInputStream in = new ObjectInputStream(stream);",
|
||
"after": "Message value = parseValidatedMessage(stream);",
|
||
"fix": "Prefer constrained DTO parsing over native object deserialization; migrate trusted legacy data separately.",
|
||
"check": "Unknown types cannot be constructed; ordinary messages stay compatible.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/java.md#java-object",
|
||
"reason": "Review signal: Java ObjectInputStream. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bObjectInputStream\\b|\\.readObject\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-RNG",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "java.util.Random near a possible secret",
|
||
"before": "Random rng = new Random();",
|
||
"after": "SecureRandom rng = new SecureRandom();",
|
||
"fix": "Use SecureRandom and sufficient token length for secrets.",
|
||
"check": "No predictable seed or fallback exists; valid tokens work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/java.md#java-rng",
|
||
"reason": "Review signal: java.util.Random near a possible secret. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bnew\\s+(?:java\\.util\\.)?Random\\s*\\(|\\bMath\\.random\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-SQL",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "Dynamic JDBC SQL",
|
||
"before": "statement.executeQuery(\"SELECT id FROM notes WHERE name=\" + name);",
|
||
"after": "PreparedStatement q = connection.prepareStatement(\"SELECT id FROM notes WHERE name=?\");\nq.setString(1, name);\nq.executeQuery();",
|
||
"fix": "Bind values with PreparedStatement, not already-concatenated SQL; allowlist identifiers.",
|
||
"check": "Quotes stay data and ownership remains enforced.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/java.md#java-sql",
|
||
"reason": "Review signal: Dynamic JDBC SQL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\.(?:executeQuery|executeUpdate|execute|prepareStatement|prepareCall)\\s*\\(\\s*(?:\"(?:\\\\.|[^\"\\\\\\r\\n]){0,500}\"\\s*\\+|String\\s*\\.\\s*format\\s*\\()",
|
||
"detection": "Regex: executeQuery/executeUpdate/execute/prepareStatement/prepareCall with concatenation or String.format. PreparedStatement does not secure already-built SQL; inspect SQL variables and formatter wrappers.",
|
||
"limitations": "Regex: executeQuery/executeUpdate/execute/prepareStatement/prepareCall with concatenation or String.format. PreparedStatement does not secure already-built SQL; inspect SQL variables and formatter wrappers.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-PROCESS",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "Java process execution",
|
||
"before": "Runtime.getRuntime().exec(command);",
|
||
"after": "runValidatedConversion(inputPath); // fixed executable and validated argv inside",
|
||
"fix": "Use a library operation or fixed executable with validated argv and bounded time/output.",
|
||
"check": "Arguments cannot choose another operation; output stays compatible.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/java.md#java-process",
|
||
"reason": "Review signal: Java process execution. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bRuntime\\.getRuntime\\s*\\(\\s*\\)\\.exec\\s*\\(|\\bnew\\s+ProcessBuilder\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-DESERIALIZE",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "Type-controlled .NET deserialization",
|
||
"before": "var formatter = new BinaryFormatter();",
|
||
"after": "var value = JsonSerializer.Deserialize<MessageDto>(json); // validate fields",
|
||
"fix": "Use explicit DTOs and a supported serializer with schema/size checks; remove unrestricted type activation and migrate legacy data.",
|
||
"check": "Unknown types fail before side effects; valid records parse.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-deserialize",
|
||
"reason": "Review signal: Type-controlled .NET deserialization. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:BinaryFormatter|NetDataContractSerializer)\\b|\\bTypeNameHandling\\s*=\\s*TypeNameHandling\\.(?:All|Auto|Objects|Arrays)",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-ENUM",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "Enum.TryParse requires an allowed-value check",
|
||
"before": "bool ok = Enum.TryParse(input, out FilterKind kind);",
|
||
"after": "if (!TryParseAllowedFilter(input, out FilterKind kind)) return BadRequest(); // helper validates named allowlist",
|
||
"fix": "Validate allowed named values; parsing success alone does not prove enum membership.",
|
||
"check": "Unnamed numeric values and unsupported flags fail; supported filters work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-enum",
|
||
"reason": "Review signal: Enum.TryParse requires an allowed-value check. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bEnum\\.TryParse(?:<[^>]{1,100}>)?\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-SQL",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "Dynamic .NET SQL",
|
||
"before": "context.Notes.FromSqlRaw(\"SELECT * FROM notes WHERE name=\" + name);",
|
||
"after": "context.Notes.FromSqlRaw(\"SELECT * FROM notes WHERE name={0}\", name);",
|
||
"fix": "Use provider-supported parameters and allowlisted identifiers.",
|
||
"check": "Quotes cannot change SQL structure; tenant restrictions remain.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-sql",
|
||
"reason": "Review signal: Dynamic .NET SQL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:FromSqlRaw|ExecuteSqlRaw)\\s*\\(\\s*(?:\\$\\\"|\\\"[^\\n]{0,500}\\\"\\s*\\+)",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-BOUNDS",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "Unbounded C/C++ copy",
|
||
"before": "strcpy(destination, source);",
|
||
"after": "size_t n = strlen(source);\nif (n >= capacity) return ERROR;\nmemcpy(destination, source, n + 1);",
|
||
"fix": "Check length/capacity before copying and check snprintf's result; mechanical strncpy replacement is insufficient.",
|
||
"check": "Test empty, boundary and oversized input; use ASan/UBSan where available.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-bounds",
|
||
"reason": "Review signal: Unbounded C/C++ copy. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:strcpy|strcat|sprintf|gets)\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-FORMAT",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "Variable used as a format string",
|
||
"before": "printf(message);",
|
||
"after": "printf(\"%s\", message);",
|
||
"fix": "Use a fixed format and checked arguments; pass explicit lengths for binary data.",
|
||
"check": "Percent characters print without interpreting directives.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-format",
|
||
"reason": "Review signal: Variable used as a format string. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bprintf\\s*\\(\\s*[A-Za-z_]\\w*\\s*[,)]|\\bfprintf\\s*\\(\\s*[^,]{1,100},\\s*[A-Za-z_]\\w*\\s*[,)]",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-SHELL",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "C/C++ shell execution",
|
||
"before": "system(command);",
|
||
"after": "run_fixed_tool(validated_filename); // fixed executable + argv inside",
|
||
"fix": "Use execve/posix_spawn with fixed program and validated argv; handle errors.",
|
||
"check": "Metacharacters are not interpreted by a shell.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-shell",
|
||
"reason": "Review signal: C/C++ shell execution. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:system|popen)\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CFG-SECRET",
|
||
"languages": [
|
||
"python",
|
||
"javascript",
|
||
"php",
|
||
"go",
|
||
"java",
|
||
"csharp",
|
||
"config",
|
||
"ruby",
|
||
"rust"
|
||
],
|
||
"title": "Literal secret or default key",
|
||
"before": "JWT_SECRET = \"development\"",
|
||
"after": "JWT_SECRET = load_existing_secret()",
|
||
"fix": "Check active fallbacks; read secrets from private configuration. Rotate with migration/rollback for sessions and data.",
|
||
"check": "No shared fallback remains; legitimate sessions/data stay recoverable.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-secret",
|
||
"reason": "Review signal: Literal secret or default key. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:jwt[_-]?(?:secret|key)|secret[_-]?key|session[_-]?secret|admin[_-]?password)\\b[\\\"']?\\s*(?::\\s*(?:str|string))?\\s*[:=]\\s*[\\\"'][^\\\"'\\r\\n]{1,200}[\\\"']",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-DEBUG",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Debug enabled in configuration",
|
||
"before": "DEBUG=true",
|
||
"after": "DEBUG=false",
|
||
"fix": "Disable runtime debug and keep private diagnostics without secrets.",
|
||
"check": "Errors expose neither console nor stack trace.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-debug",
|
||
"reason": "Review signal: Debug enabled in configuration. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:DEBUG|FLASK_DEBUG|APP_DEBUG)\\s*[:=]\\s*[\\\"']?(?:true|1)\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "information-disclosure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-CORS",
|
||
"languages": [
|
||
"config",
|
||
"javascript",
|
||
"python",
|
||
"go",
|
||
"java",
|
||
"csharp"
|
||
],
|
||
"title": "Broad CORS policy",
|
||
"before": "Access-Control-Allow-Origin: *",
|
||
"after": "Access-Control-Allow-Origin: https://ui.example.invalid",
|
||
"fix": "Allowlist actual origins and use Vary: Origin where needed; authentication and CSRF remain separate. A wildcard alone is not an auth bypass.",
|
||
"check": "Authorized browsers work; unrelated origins cannot read private responses.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-cors",
|
||
"reason": "Review signal: Broad CORS policy. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "(?:Access-Control-Allow-Origin|allow_origins|allowedOrigins|cors_origin)\\s*[\\\"']?\\s*[:=]\\s*\\[?\\s*[\\\"']?\\*",
|
||
"limitations": "Legacy wildcard header/config heuristic (untyped). JS bounded tokens also detect default imported/required cors with inline origin:true and credentials:true, literal quoted keys and last-write-wins fields. Observed shadows/reassignments suppress the new hint. Computed keys, variables, wrappers, actual response policy and other languages remain manual.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review",
|
||
"detection": "Legacy wildcard header/config heuristic (untyped). JS bounded tokens also detect default imported/required cors with inline origin:true and credentials:true, literal quoted keys and last-write-wins fields. Observed shadows/reassignments suppress the new hint. Computed keys, variables, wrappers, actual response policy and other languages remain manual.",
|
||
"coverage_required": [
|
||
"javascript"
|
||
]
|
||
},
|
||
{
|
||
"id": "CFG-DOCKER-PRIV",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Privileged container",
|
||
"before": "privileged: true",
|
||
"after": "privileged: false",
|
||
"fix": "Identify minimum capabilities and change only authorized owned services, not organizer infrastructure.",
|
||
"check": "Service/checker works without unnecessary privileges.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-docker-priv",
|
||
"reason": "Review signal: Privileged container. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bprivileged[\"\\']?\\s*:\\s*true\\b|\\bcap_add[\"\\']?\\s*:\\s*\\[[^\\]]{0,300}\\b(?:SYS_ADMIN|ALL)\\b",
|
||
"detection": "Regex: privileged:true and cap_add with SYS_ADMIN/ALL, including quoted JSON keys. CFG-CAPABILITIES covers block capabilities; inspect effective Docker/Kubernetes config.",
|
||
"limitations": "Regex: privileged:true and cap_add with SYS_ADMIN/ALL, including quoted JSON keys. CFG-CAPABILITIES covers block capabilities; inspect effective Docker/Kubernetes config.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-DOCKER-SOCKET",
|
||
"languages": [
|
||
"config",
|
||
"docker",
|
||
"shell"
|
||
],
|
||
"title": "Docker socket exposed to a service",
|
||
"before": "- /var/run/docker.sock:/var/run/docker.sock",
|
||
"after": "- app-data:/srv/data",
|
||
"fix": "Remove unnecessary mounts after checking dependencies/rules; never alter unrelated containers automatically.",
|
||
"check": "Required service and approved management operations work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-docker-socket",
|
||
"reason": "Review signal: Docker socket exposed to a service. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "/(?:var/)?run/docker\\.sock",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-DOCKER-ROOT",
|
||
"languages": [
|
||
"docker"
|
||
],
|
||
"title": "Explicit Docker USER root",
|
||
"before": "USER root",
|
||
"after": "USER app",
|
||
"fix": "Prepare an unprivileged user and directory permissions; missing USER is not detected by this rule.",
|
||
"check": "Volumes, ports, writes and restart work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-docker-root",
|
||
"reason": "Review signal: Explicit Docker USER root. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "^\\s*USER\\s+(?:root|0)(?:\\s|:|$)",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-WORLD-WRITE",
|
||
"languages": [
|
||
"docker",
|
||
"shell"
|
||
],
|
||
"title": "Broad write permissions",
|
||
"before": "chmod -R 777 /srv/app",
|
||
"after": "chmod 750 /srv/app",
|
||
"fix": "Set intended owner/group and minimum modes; do not recursively replace permissions blindly.",
|
||
"check": "Service can write data; others cannot change code.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-world-write",
|
||
"reason": "Review signal: Broad write permissions. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bchmod\\s+(?:-[A-Za-z]+\\s+)*(?:0?777|0?666|a\\+w)\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-NGINX-LIST",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "nginx directory listing",
|
||
"before": "autoindex on;",
|
||
"after": "autoindex off;",
|
||
"fix": "Disable listing unless it is required functionality.",
|
||
"check": "Downloads work; private directory contents are not enumerated.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-nginx-list",
|
||
"reason": "Review signal: nginx directory listing. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bautoindex\\s+on\\s*;",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "file-access",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-NGINX-ALIAS",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Review nginx alias boundaries",
|
||
"before": "location /files { alias /srv/files/; }",
|
||
"after": "location /files/ { root /srv; } # verify mapping and auth",
|
||
"fix": "Align location /files/ with alias /srv/files/; review normalization/auth. Correct aliases also trigger review.",
|
||
"check": "Boundary URLs stay inside the root; old public URLs work.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-nginx-alias",
|
||
"reason": "Review signal: Review nginx alias boundaries. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\balias\\s+[^;]{1,500};",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-22"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-POSTGRES-TRUST",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "PostgreSQL trust authentication",
|
||
"before": "POSTGRES_HOST_AUTH_METHOD: trust",
|
||
"after": "POSTGRES_HOST_AUTH_METHOD: scram-sha-256",
|
||
"fix": "Use supported auth and coordinated application credentials; do not change organizer accounts/network.",
|
||
"check": "Application connects; unknown credentials fail.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-postgres-trust",
|
||
"reason": "Review signal: PostgreSQL trust authentication. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bPOSTGRES_HOST_AUTH_METHOD[\"\\']?\\s*[:=]\\s*[\"\\']?trust\\b|^[ \\t]*local[ \\t]+\\S+[ \\t]+\\S+[ \\t]+trust\\b|^[ \\t]*host(?:ssl|nossl|gssenc|nogssenc)?[ \\t]+\\S+[ \\t]+\\S+[ \\t]+\\S+[ \\t]+(?:\\S+[ \\t]+)?trust\\b",
|
||
"detection": "Regex: POSTGRES_HOST_AUTH_METHOD=trust including JSON; pg_hba local/host/hostssl/hostnossl/hostgssenc/hostnogssenc with trust and CIDR or separate IPv4 netmask. Inspect HBA order and actual matching entries.",
|
||
"limitations": "Regex: POSTGRES_HOST_AUTH_METHOD=trust including JSON; pg_hba local/host/hostssl/hostnossl/hostgssenc/hostnogssenc with trust and CIDR or separate IPv4 netmask. Inspect HBA order and actual matching entries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-REDIS-PROTECTION",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Redis protected-mode disabled",
|
||
"before": "protected-mode no",
|
||
"after": "protected-mode yes",
|
||
"fix": "Review ACL, credentials, bind and clients against game rules without blocking required traffic.",
|
||
"check": "Application connects with minimum required permissions.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-redis-protection",
|
||
"reason": "Review signal: Redis protected-mode disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bprotected-mode\\s+no\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "TPL-RAW",
|
||
"languages": [
|
||
"template"
|
||
],
|
||
"title": "Unescaped template output",
|
||
"before": "{{ message | safe }}",
|
||
"after": "{{ message }}",
|
||
"fix": "Use normal escaped text output or a context-tested sanitizer for permitted HTML.",
|
||
"check": "User markup stays text and layout remains intact.",
|
||
"engine": "regex",
|
||
"doc": "docs/vulnerabilities/configuration.md#tpl-raw",
|
||
"reason": "Review signal: Unescaped template output. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\|\\s*(?:safe|raw)\\b|\\{\\{\\{[\\s\\S]{0,300}?\\}\\}\\}|<%-",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SRC-MIXED-IDENTIFIER",
|
||
"languages": [
|
||
"python",
|
||
"javascript",
|
||
"php",
|
||
"go",
|
||
"java",
|
||
"csharp",
|
||
"native",
|
||
"ruby",
|
||
"rust",
|
||
"shell"
|
||
],
|
||
"title": "Mixed Latin/Cyrillic/Greek identifier",
|
||
"before": "uuіd = input_value",
|
||
"after": "validated_uuid = parse_uuid(input_value)",
|
||
"fix": "Inspect code points/references and use distinguishable names and the validated value; never blindly rename text.",
|
||
"check": "Validation and consumption use the same value; invalid input fails. Strings/comments may be harmless.",
|
||
"doc": "docs/vulnerabilities/configuration.md#src-mixed-identifier",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Mixed Latin/Cyrillic/Greek identifier. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?=\\w{0,127}[A-Za-z])(?=\\w{0,127}[\\u0370-\\u03ff\\u0400-\\u052f])\\w{1,128}\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SRC-BIDI-CONTROL",
|
||
"languages": [
|
||
"python",
|
||
"javascript",
|
||
"php",
|
||
"go",
|
||
"java",
|
||
"csharp",
|
||
"native",
|
||
"ruby",
|
||
"rust",
|
||
"shell",
|
||
"config",
|
||
"template",
|
||
"sql"
|
||
],
|
||
"title": "Bidirectional text control in source",
|
||
"before": "# direction marker",
|
||
"after": "# explicit plain-text comment",
|
||
"fix": "Inspect actual Unicode/token order and remove unnecessary controls; review legitimate localization separately.",
|
||
"check": "Rendered and actual flow agree; copying does not restore controls.",
|
||
"doc": "docs/vulnerabilities/configuration.md#src-bidi-control",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Bidirectional text control in source. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "[\\u202a-\\u202e\\u2066-\\u2069]",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-SHELL",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "Go exec.Command launches a shell",
|
||
"before": "cmd := exec.Command(\"sh\", \"-c\", command)",
|
||
"after": "cmd := exec.Command(\"/usr/bin/file\", \"--\", filename)",
|
||
"fix": "Use fixed executable plus argv. Pass stdin records without a shell and validate their separators.",
|
||
"check": "Metacharacters stay data; dangerous options/separators fail; supported arguments work.",
|
||
"doc": "docs/vulnerabilities/go.md#go-shell",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Go exec.Command launches a shell. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b[A-Za-z_]\\w*\\s*\\.\\s*(?:Command\\s*\\(\\s*|CommandContext\\s*\\(\\s*[^,\\n]{1,160},\\s*)\"(?:/(?:usr/)?bin/)?(?:sh|bash|zsh|dash|ksh)\"\\s*,\\s*\"-(?:c|lc|ec)\"",
|
||
"detection": "Regex: any receiver.Command/CommandContext with literal shell and -c/-lc/-ec. Simple context expressions including r.Context() work; nested commas may hide a call. Inspect receiver type and command trust.",
|
||
"limitations": "Regex: any receiver.Command/CommandContext with literal shell and -c/-lc/-ec. Simple context expressions including r.Context() work; nested commas may hide a call. Inspect receiver type and command trust.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-CRC",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "CRC near an identifier or trust boundary",
|
||
"before": "resource := service.CRC.Calculate(username)",
|
||
"after": "resource := sha256.Sum256([]byte(username))",
|
||
"fix": "CRC is not an ownership boundary. Use unique server-owned IDs plus authorization or HMAC for authenticity.",
|
||
"check": "Collisions cannot change ownership; old IDs have a migration path.",
|
||
"doc": "docs/vulnerabilities/go.md#go-crc",
|
||
"engine": "regex",
|
||
"reason": "Review signal: CRC near an identifier or trust boundary. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:crc32|crc64)\\.(?:Checksum|ChecksumIEEE|New|NewIEEE)\\s*\\(|\\bCRC(?:\\d+)?\\.(?:Calculate|Checksum)\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-MATH-RAND",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "math/rand near a possible secret",
|
||
"before": "import \"math/rand\"\nrand.Seed(time.Now().UnixMilli())",
|
||
"after": "import \"crypto/rand\"\n_, err := rand.Read(token)\nif err != nil { return err }",
|
||
"fix": "Use crypto/rand and handle errors; alphabet shuffling/hidden seeds do not create a CSPRNG.",
|
||
"check": "Entropy/length suffice and failure never creates a predictable fallback.",
|
||
"doc": "docs/vulnerabilities/go.md#go-math-rand",
|
||
"engine": "regex",
|
||
"reason": "Review signal: math/rand near a possible secret. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\\"math/rand(?:/v2)?\\\"",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-CRC",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "CRC/Adler near an integrity boundary",
|
||
"before": "import zlib\ntag = zlib.crc32(payload)",
|
||
"after": "import hmac\ntag = hmac.digest(key, payload, 'sha256')",
|
||
"fix": "Use HMAC/signatures for authenticity or unique IDs plus authorization; ordinary checksums may remain CRC.",
|
||
"check": "Modified messages without the key fail; formats/records stay compatible.",
|
||
"doc": "docs/vulnerabilities/python.md#py-crc",
|
||
"engine": "python-ast",
|
||
"reason": "Review signal: CRC/Adler near an integrity boundary. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-PRNG",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "Ordinary PRNG/LCG near a possible secret",
|
||
"before": "srand((unsigned)time(NULL));\ntoken = rand();",
|
||
"after": "if (!fill_from_os_csprng(token, sizeof token)) return ERROR; // implement using supported OS/library API",
|
||
"fix": "Use system CSPRNG/supported crypto and check results; ordinary non-security randomness may use a PRNG.",
|
||
"check": "No predictable seed/fallback exists; token format stays compatible.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-prng",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Ordinary PRNG/LCG near a possible secret. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:srand|rand|random|srandom|lcgrand|slcgrand)\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-SNPRINTF-FORMAT",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "Variable format in bounded printf",
|
||
"before": "snprintf(out, capacity, message);",
|
||
"after": "snprintf(out, capacity, \"%s\", message);",
|
||
"fix": "Use a fixed format; buffer limits do not secure untrusted format strings. Trace wrappers/macros.",
|
||
"check": "Percent characters stay text, truncation is handled; legitimate wrappers may still match.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-snprintf-format",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Variable format in bounded printf. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:snprintf|vsnprintf|safe_snprintf)\\s*\\(\\s*[^,;\\n]{1,180},\\s*(?:sizeof\\s*\\([^)]{1,100}\\)|[^,;\\n]{1,180})\\s*,\\s*[A-Za-z_]\\w*(?:\\[[^\\]]{1,100}\\])?\\s*[,)]",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-RECV-TERMINATOR",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "recv/read result used as an index",
|
||
"before": "n = recv(fd, buffer, sizeof buffer, 0);\nbuffer[n] = '\\0';",
|
||
"after": "ssize_t n = recv(fd, buffer, sizeof buffer - 1, 0);\nif (n <= 0) return ERROR;\nbuffer[n] = '\\0';",
|
||
"fix": "Reserve NUL space, handle negative/EOF results before indexing, and handle short reads. Correct code may still match.",
|
||
"check": "Test errors, EOF, full buffer, short reads and normal messages.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-recv-terminator",
|
||
"engine": "regex",
|
||
"reason": "Review signal: recv/read result used as an index. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?P<read_count>[A-Za-z_]\\w*)\\s*=\\s*(?:recv|read)\\s*\\([^;]{1,300}\\);[\\s\\S]{0,400}?\\b[A-Za-z_]\\w*\\s*\\[\\s*(?P=read_count)\\s*\\]\\s*=",
|
||
"review_after": true,
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-XPATH",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "XPath assembled from strings",
|
||
"before": "node.xpath(\"//user[name='%s']\" % username)",
|
||
"after": "node.xpath(\"//user[name=$name]\", name=username)",
|
||
"fix": "Bind variables with the actual API and keep XPath fixed; do not quote data into syntax.",
|
||
"check": "Quotes/brackets stay data; search scope/ownership does not expand.",
|
||
"doc": "docs/vulnerabilities/python.md#py-xpath",
|
||
"engine": "python-ast",
|
||
"reason": "Review signal: XPath assembled from strings. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"detection": "AST: xpath/XPath by method name and string construction in first argument or simple assignment. String literals, Add-concatenated literals and f-strings without FormattedValue do not signal; %, format and interpolated f-strings require review. No arbitrary evaluation; inspect wrappers, XPath variables and trust.",
|
||
"limitations": "AST: xpath/XPath by method name and string construction in first argument or simple assignment. String literals, Add-concatenated literals and f-strings without FormattedValue do not signal; %, format and interpolated f-strings require review. No arbitrary evaluation; inspect wrappers, XPath variables and trust.",
|
||
"family": "injection",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-UUID-BYTES",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "UUID bytes/bytes_le protocol boundary",
|
||
"before": "import uuid\nvalue = uuid.UUID(bytes_le=wire_bytes)",
|
||
"after": "import uuid\nvalue = uuid.UUID(wire_text) # canonical text contract",
|
||
"fix": "Agree on canonical text or documented byte order across languages/cache/DB; bytes_le is not inherently unsafe.",
|
||
"check": "Asymmetric vectors and round trips agree; old references remain valid.",
|
||
"doc": "docs/vulnerabilities/python.md#py-uuid-bytes",
|
||
"engine": "python-ast",
|
||
"reason": "Review signal: UUID bytes/bytes_le protocol boundary. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-GUID-BYTES",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "Byte-order Guid protocol boundary",
|
||
"before": "var value = new Guid(wireBytes);",
|
||
"after": "var value = Guid.ParseExact(wireText, \"D\");",
|
||
"fix": "Agree on byte order with peers; use canonical text or explicit conversion, not arbitrary reversal.",
|
||
"check": "Asymmetric UUID vectors agree across C#/Python, database and cache.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-guid-bytes",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Byte-order Guid protocol boundary. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bnew\\s+Guid\\s*\\(\\s*[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*\\s*\\)",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SQL-UPSERT",
|
||
"languages": [
|
||
"sql",
|
||
"python",
|
||
"javascript",
|
||
"php",
|
||
"go",
|
||
"java",
|
||
"csharp",
|
||
"ruby",
|
||
"rust"
|
||
],
|
||
"title": "Upsert/replace requires ownership review",
|
||
"before": "INSERT INTO notes(id, owner, body) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE body=VALUES(body);",
|
||
"after": "UPDATE notes SET body=? WHERE id=? AND owner=?;",
|
||
"fix": "Separate create/update, normalize before authorization, enforce ownership in atomic UPDATE and check rows, uniqueness and transactions.",
|
||
"check": "Case/Unicode/trigger conflicts cannot update another owner; normal edits work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-upsert",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Upsert/replace requires ownership review. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bON\\s+DUPLICATE\\s+KEY\\s+UPDATE\\b|\\bON\\s+CONFLICT[\\s\\S]{0,200}?\\bDO\\s+UPDATE\\b|\\bINSERT\\s+OR\\s+REPLACE\\s+INTO\\b|\\bREPLACE\\s+INTO\\b",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-READALL-BODY",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "ReadAll on a request body",
|
||
"before": "body, err := io.ReadAll(r.Body)",
|
||
"after": "r.Body = http.MaxBytesReader(w, r.Body, 1<<20)\nbody, err := io.ReadAll(r.Body)\nif err != nil { return } // map to an appropriate client error",
|
||
"fix": "Limit the body before reading and handle excess size; the rule does not track earlier MaxBytesReader calls.",
|
||
"check": "Test limit-1/limit/limit+1 and streams without Content-Length.",
|
||
"doc": "docs/vulnerabilities/go.md#go-readall-body",
|
||
"engine": "regex",
|
||
"reason": "Review signal: ReadAll on a request body. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:io|ioutil)\\.ReadAll\\s*\\(\\s*[A-Za-z_]\\w*\\.Body\\s*\\)",
|
||
"review_after": true,
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "resource-limits",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-TRUST-PROXY",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Unrestricted trust in proxy headers",
|
||
"before": "app.set('trust proxy', true);",
|
||
"after": "app.set('trust proxy', isKnownProxy); // implement topology-specific peer validation",
|
||
"fix": "Trust actual immediate proxies, not client X-Forwarded-* as authentication; do not change organizer networking.",
|
||
"check": "Spoofed direct headers grant no trusted identity/IP/scheme; proxy works.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-trust-proxy",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Unrestricted trust in proxy headers. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\.set\\s*\\(\\s*[\\\"']trust proxy[\\\"']\\s*,\\s*true\\s*\\)",
|
||
"limitations": "Regex with comment/string exclusions: .set('trust proxy', true). Receiver untyped; true may be valid behind proxies that overwrite forwarded headers. No effective topology or proxy-hop verification; inspect all direct entrypoints and the immediate peer.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"detection": "Regex with comment/string exclusions: .set('trust proxy', true). Receiver untyped; true may be valid behind proxies that overwrite forwarded headers. No effective topology or proxy-hop verification; inspect all direct entrypoints and the immediate peer.",
|
||
"coverage_required": [
|
||
"javascript"
|
||
],
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "PY-ASSERT-AUTH",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Access control using assert",
|
||
"before": "assert note.owner_id == current_user.id",
|
||
"after": "if note.owner_id != current_user.id:\n raise PermissionError('access denied')",
|
||
"fix": "Use explicit denial active under -O; do not blanket-replace ordinary test assertions.",
|
||
"check": "Unauthorized objects fail in normal/optimized mode; authorized actions work.",
|
||
"doc": "docs/vulnerabilities/python.md#py-assert-auth",
|
||
"engine": "python-ast",
|
||
"reason": "Review signal: Access control using assert. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"limitations": "Bounded syntactic AST analysis, not type resolution or interprocedural taint analysis. Review actual API, inputs and authorization.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-OBJECT",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Ruby Marshal or unsafe YAML",
|
||
"before": "record = Marshal.load(payload)",
|
||
"after": "record = JSON.parse(payload) # validate DTO schema and size",
|
||
"fix": "Use JSON or bounded YAML.safe_load with class/alias policy and schema; migrate trusted legacy data separately.",
|
||
"check": "Arbitrary objects are not built; old valid data works.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-object",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Ruby Marshal or unsafe YAML. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bMarshal\\.(?:load|restore)\\s*(?:\\(|\\s)|\\b(?:YAML|Psych)\\.unsafe_load\\s*(?:\\(|\\s)",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-SHELL",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Ruby shell string",
|
||
"before": "system(command)",
|
||
"after": "system(\"/usr/bin/file\", \"--\", filename)",
|
||
"fix": "Use fixed executable plus separate validated argv; backticks and %x also invoke shell.",
|
||
"check": "Metacharacters cannot become commands; normal files work.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-shell",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Ruby shell string. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:system|exec)\\s*\\(\\s*[A-Za-z_]\\w*\\s*\\)|\\b(?:system|exec)\\s*\\(\\s*\\\"[^\\\"\\n]{0,500}#\\{|%x[\\[({]|\\x60[^\\x60\\n]{1,500}\\x60",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-EVAL",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Ruby eval/ERB from data",
|
||
"before": "result = eval(input)",
|
||
"after": "result = JSON.parse(input) # validate expected schema",
|
||
"fix": "Use trusted templates plus values or a restricted parser instead of executing data.",
|
||
"check": "Ruby syntax stays data; normal input parses.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-eval",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Ruby eval/ERB from data. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:eval|instance_eval|class_eval|module_eval)\\s*\\(|\\bERB\\.new\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-94"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUST-UNSAFE-CONVERSION",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"title": "Rust unchecked/raw conversion",
|
||
"before": "let text = unsafe { std::str::from_utf8_unchecked(data) };",
|
||
"after": "let text = std::str::from_utf8(data)?;",
|
||
"fix": "Prefer checked APIs; necessary unsafe needs length, alignment, lifetime, initialization and aliasing proofs. Do not remove it blindly.",
|
||
"check": "Test invalid UTF-8/length/index and EOF; use Miri/sanitizers where prepared.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-unsafe-conversion",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Rust unchecked/raw conversion. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:from_utf8_unchecked|from_raw_parts(?:_mut)?|get_unchecked(?:_mut)?|transmute|set_len)\\s*(?:::\\s*<[^>]{1,150}>)?\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUST-SQL-FORMAT",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"title": "Rust SQL using format!",
|
||
"before": "sqlx::query(&format!(\"SELECT * FROM notes WHERE name={}\", name));",
|
||
"after": "sqlx::query(\"SELECT * FROM notes WHERE name=$1\").bind(name);",
|
||
"fix": "Use driver binding and allowlisted identifiers; placeholder syntax is database-specific.",
|
||
"check": "Quotes remain data and ownership predicates work.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-sql-format",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Rust SQL using format!. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:query|query_as|sql_query)\\s*\\(\\s*&?\\s*format!\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-PREFIX-MAC",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "Hash concatenation instead of MAC",
|
||
"before": "$tag = sha1($key . $payload);",
|
||
"after": "$tag = hash_hmac('sha256', $payload, $key);",
|
||
"fix": "Use HMAC rather than a hash of secret concatenated with data, compare with hash_equals and migrate/version old formats.",
|
||
"check": "Changed/appended data fails; tags bind purpose and all authentication fields.",
|
||
"doc": "docs/vulnerabilities/php.md#php-prefix-mac",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Hash concatenation instead of MAC. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:sha1|md5)\\s*\\(\\s*\\$[A-Za-z_]\\w*\\s*\\.",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-PARSE-STR",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "parse_str key normalization",
|
||
"before": "parse_str($token_data, $params);",
|
||
"after": "$params = parse_and_validate_canonical_share_dto($token_data); // one schema, duplicate policy, server-owned fields",
|
||
"fix": "Use identical schemas before signing/after parsing; account for dots/spaces becoming underscores, arrays and duplicate keys.",
|
||
"check": "Alternate spellings cannot change owner/document; signer and verifier agree.",
|
||
"doc": "docs/vulnerabilities/php.md#php-parse-str",
|
||
"engine": "regex",
|
||
"reason": "Review signal: parse_str key normalization. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\bparse_str\\s*\\(",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-CURL-ARGV",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Node.js curl: review URL and options",
|
||
"before": "spawn('/usr/bin/curl', [url, '-o', filename]);",
|
||
"after": "downloadValidatedHttpResource(url, destination); // bounded HTTP client, checked redirects/DNS and server-chosen output",
|
||
"fix": "Separate argv does not prevent option injection. Prefer bounded HTTP APIs; otherwise fix curl options/protocols, use -- before validated URL and choose server-side output.",
|
||
"check": "Leading-dash URLs, forbidden schemes/redirects and output paths fail; normal downloads work.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-curl-argv",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Node.js curl: review URL and options. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:spawn|execFile|execFileSync)\\s*\\(\\s*[\\\"'](?:/(?:usr/)?bin/)?curl[\\\"']",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-SESSION-STATE",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Sensitive session state assignment",
|
||
"before": "const user = req.body;\nreq.session.user = user;",
|
||
"after": "req.session.user = {id: savedUser.id, friends: savedUser.friends}; // server-validated fields only",
|
||
"fix": "Build session DTOs from persisted validated records; bind related state server-side and reject client privilege fields.",
|
||
"check": "Extra role/friends fields or endpoint reordering cannot change access; correct assignments may still match.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-session-state",
|
||
"engine": "regex",
|
||
"reason": "Review signal: Sensitive session state assignment. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"pattern": "\\b(?:req|request)\\.session\\.(?:user|author|owner|role|friends)\\s*=",
|
||
"review_after": true,
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CFG-REDIS-ACL",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Redis ACL user without a password",
|
||
"engine": "regex",
|
||
"pattern": "^[ \\t]*(?-i:user) [^ \\t\\r\\n]+(?: |$)",
|
||
"reason": "Review signal: Redis ACL user without a password. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "user default on nopass ~* &* +@all",
|
||
"after": "user default off",
|
||
"fix": "First provision credentials and minimum commands/keys/channels for an app user; migrate clients and test AUTH/reconnect. Only then remove nopass or disable default. An empty > value is not a secure password.",
|
||
"check": "New app-user connections work before disabling default; new anonymous connections then fail. Check existing connections, namespaces, Pub/Sub and transactions.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-redis-acl",
|
||
"detection": "Regex selects user lines, then a bounded parser reads the physical line up to 8192 characters: lowercase user, one ASCII space before a nonempty username and ordinary modifier spaces. on/off/reset and nopass/resetpass/>password/#64lowerhex are processed in order; both final flags must be explicitly true. Names, passwords and key/channel patterns are not flags. Quotes, escapes, internal tabs, selectors and unknown operations need review; long lines are partial. This is not effective ACL analysis: inspect includes/runtime, grant validity, password strength and existing connections.",
|
||
"references": [
|
||
"https://redis.io/docs/latest/operate/oss_and_stack/management/security/acl/",
|
||
"https://github.com/redis/redis/blob/7.2.7/src/acl.c",
|
||
"https://github.com/redis/redis/blob/7.2.7/src/config.c",
|
||
"https://github.com/redis/redis/blob/7.2.7/tests/unit/acl.tcl"
|
||
],
|
||
"limitations": "Regex selects user lines, then a bounded parser reads the physical line up to 8192 characters: lowercase user, one ASCII space before a nonempty username and ordinary modifier spaces. on/off/reset and nopass/resetpass/>password/#64lowerhex are processed in order; both final flags must be explicitly true. Names, passwords and key/channel patterns are not flags. Quotes, escapes, internal tabs, selectors and unknown operations need review; long lines are partial. This is not effective ACL analysis: inspect includes/runtime, grant validity, password strength and existing connections.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-MONGO-NOAUTH",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "MongoDB authorization disabled",
|
||
"engine": "regex",
|
||
"pattern": "\\bauthorization\\s*:\\s*disabled\\b",
|
||
"reason": "Review signal: MongoDB authorization disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "security:\n authorization: disabled",
|
||
"after": "security:\n authorization: enabled",
|
||
"fix": "Prepare application credentials and least-privilege roles before enabling auth on an owned service.",
|
||
"check": "Restart/reconnect and CRUD work; anonymous access fails. Do not alter organizer accounts.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-mongo-noauth",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-CAPABILITIES",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Broad container capabilities",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:cap_add[\"\\']?\\s*:\\s*|capabilities[\"\\']?\\s*:[\\s\\S]{0,160}?\\badd[\"\\']?\\s*:\\s*)(?:\\[[^\\]]{0,300}\\b(?:SYS_ADMIN|ALL)\\b|(?:[ \\t]*\\n[ \\t]*-[^\\n]{0,100}){0,6}[ \\t]*\\n[ \\t]*-[ \\t]*[\"\\']?(?:SYS_ADMIN|ALL)\\b)",
|
||
"reason": "Review signal: Broad container capabilities. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "cap_add: [SYS_ADMIN]",
|
||
"after": "cap_drop: [ALL]",
|
||
"fix": "Remove unnecessary capabilities only on owned services; retain proven requirements and verify user/port/volume permissions.",
|
||
"check": "Startup/checker and required syscalls work; do not apply this to organizer launchers.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-capabilities",
|
||
"detection": "Regex: cap_add or capabilities.add with SYS_ADMIN/ALL in flow/block lists. capabilities.drop:[ALL] alone is not a grant. Bounded text windows are not YAML parsing; review nesting, merges/anchors and actual securityContext.",
|
||
"limitations": "Regex: cap_add or capabilities.add with SYS_ADMIN/ALL in flow/block lists. capabilities.drop:[ALL] alone is not a grant. Bounded text windows are not YAML parsing; review nesting, merges/anchors and actual securityContext.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-BUILD-SECRET",
|
||
"languages": [
|
||
"docker"
|
||
],
|
||
"title": "Secret in Dockerfile ARG/ENV",
|
||
"engine": "regex",
|
||
"pattern": "^\\s*(?:ARG|ENV)\\s+\\w*(?:TOKEN|PASSWORD|SECRET|PRIVATE_KEY)\\w*(?:\\s|=)",
|
||
"reason": "Review signal: Secret in Dockerfile ARG/ENV. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "ARG API_TOKEN=example",
|
||
"after": "RUN --mount=type=secret,id=api_token build-with-secret",
|
||
"fix": "Use build secret mounts instead of ARG/ENV/layers. Rotate published secrets deliberately; later deletion does not erase an earlier layer.",
|
||
"check": "Build history/logs disclose no secret; runtime secrets are separate. The sample build command is a placeholder.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-build-secret",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "secret-handling",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "SQL-DEFINER",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"title": "SECURITY DEFINER and search_path trust",
|
||
"engine": "regex",
|
||
"pattern": "\\bSECURITY\\s+DEFINER\\b",
|
||
"reason": "Review signal: SECURITY DEFINER and search_path trust. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "CREATE FUNCTION f() RETURNS int LANGUAGE sql SECURITY DEFINER AS $$ SELECT value FROM settings $$;",
|
||
"after": "CREATE FUNCTION f() RETURNS int LANGUAGE sql SECURITY INVOKER AS $$ SELECT value FROM app.settings $$;",
|
||
"fix": "Prefer INVOKER unless elevated rights are needed; otherwise use a minimal owner, fixed safe search_path with pg_temp last, qualified names and restricted EXECUTE.",
|
||
"check": "Callers cannot replace objects using temporary/writable schemas; valid calls work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-definer",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SQL-BYPASSRLS",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"title": "Application role bypasses RLS",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:CREATE|ALTER)\\s+(?:ROLE|USER)\\b[^;]{0,300}\\b(?:BYPASSRLS|SUPERUSER)\\b",
|
||
"reason": "Review signal: Application role bypasses RLS. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "ALTER ROLE app BYPASSRLS;",
|
||
"after": "ALTER ROLE app NOBYPASSRLS NOSUPERUSER;",
|
||
"fix": "Use a runtime role without elevated attributes and review table ownership separately; FORCE RLS does not constrain superuser/BYPASSRLS.",
|
||
"check": "Actual runtime roles for two tenants cannot cross boundaries; migration role is separate.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-bypassrls",
|
||
"limitations": "Bounded SQL: CREATE/ALTER ROLE or USER with explicit SUPERUSER/BYPASSRLS, comments and quoted strings excluded, unquoted keywords and statements up to 300 characters. Later overrides, ownership, inherited roles and effective runtime policy remain manual.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"detection": "Bounded SQL: CREATE/ALTER ROLE or USER with explicit SUPERUSER/BYPASSRLS, comments and quoted strings excluded, unquoted keywords and statements up to 300 characters. Later overrides, ownership, inherited roles and effective runtime policy remain manual.",
|
||
"coverage_required": [
|
||
"sql"
|
||
],
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "SQL-PUBLIC-GRANT",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"title": "Broad privileges granted to PUBLIC",
|
||
"engine": "regex",
|
||
"pattern": "\\bGRANT\\s+(?:ALL(?:\\s+PRIVILEGES)?|(?:SELECT|INSERT|UPDATE|DELETE|TRUNCATE|REFERENCES|TRIGGER|CREATE|USAGE|EXECUTE|CONNECT|TEMPORARY|TEMP)(?:\\s*,\\s*(?:SELECT|INSERT|UPDATE|DELETE|TRUNCATE|REFERENCES|TRIGGER|CREATE|USAGE|EXECUTE|CONNECT|TEMPORARY|TEMP)){0,20})\\s+ON\\b[^;]{0,250}?\\bTO\\s+PUBLIC\\b",
|
||
"reason": "Review signal: Broad privileges granted to PUBLIC. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "GRANT ALL ON notes TO PUBLIC;",
|
||
"after": "GRANT SELECT, INSERT, UPDATE ON notes TO app;",
|
||
"fix": "Grant only required actions to specific roles; review existing/default privileges, sequences and functions. Never revoke unrelated infrastructure rights.",
|
||
"check": "Neighbor roles cannot read data; app ID generation and old records work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-public-grant",
|
||
"limitations": "Bounded SQL: GRANT ALL or SELECT/INSERT/UPDATE/DELETE/TRUNCATE/REFERENCES/TRIGGER/CREATE/USAGE/EXECUTE/CONNECT/TEMPORARY/TEMP privilege lists ON an object TO PUBLIC. Comments/strings excluded; no cross-statement matching. Quoted identifiers, defaults, complex grants, effective rights and intentional public objects remain manual.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"detection": "Bounded SQL: GRANT ALL or SELECT/INSERT/UPDATE/DELETE/TRUNCATE/REFERENCES/TRIGGER/CREATE/USAGE/EXECUTE/CONNECT/TEMPORARY/TEMP privilege lists ON an object TO PUBLIC. Comments/strings excluded; no cross-statement matching. Quoted identifiers, defaults, complex grants, effective rights and intentional public objects remain manual.",
|
||
"coverage_required": [
|
||
"sql"
|
||
],
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "PY-DJANGO-HOSTS",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Django wildcard ALLOWED_HOSTS",
|
||
"engine": "regex",
|
||
"pattern": "\\bALLOWED_HOSTS\\s*=\\s*\\[\\s*[\"']\\*[\"']",
|
||
"reason": "Review signal: Django wildcard ALLOWED_HOSTS. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "ALLOWED_HOSTS = [\"*\"]",
|
||
"after": "ALLOWED_HOSTS = [\"service.internal\"]",
|
||
"fix": "Allowlist actual hostnames/IPs including the checker; use get_host instead of raw Host and review trusted proxy headers separately.",
|
||
"check": "Unknown Host fails; normal host/checker works.",
|
||
"doc": "docs/vulnerabilities/python.md#py-django-hosts",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-HTML-SAFE",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "HTML escaping explicitly bypassed",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:mark_safe|Markup)\\s*\\(",
|
||
"reason": "Review signal: HTML escaping explicitly bypassed. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "html = mark_safe(message)",
|
||
"after": "html = message",
|
||
"fix": "Use autoescaped templates; sanitize permitted rich HTML. HTML escaping does not secure JS or URL contexts.",
|
||
"check": "Tags/quotes stay data without breaking supported formatting.",
|
||
"doc": "docs/vulnerabilities/python.md#py-html-safe",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-VM",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "node:vm used as a security sandbox",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:runInNewContext|runInContext|runInThisContext)\\s*\\(",
|
||
"reason": "Review signal: node:vm used as a security sandbox. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "vm.runInNewContext(userCode, context);",
|
||
"after": "evaluateAllowedExpression(parsedInput); // implement a restricted grammar",
|
||
"fix": "node:vm is not a security boundary for untrusted code. Use a restricted grammar or a separately designed execution isolation system.",
|
||
"check": "Disallowed syntax fails; supported expressions work under time/memory limits.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-vm",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-94"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-REGEX-DYNAMIC",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Regex built from client text",
|
||
"engine": "regex",
|
||
"pattern": "\\bnew\\s+RegExp\\s*\\(\\s*[A-Za-z_]\\w*(?:\\.\\w+)*\\s*[,)]",
|
||
"reason": "Review signal: Regex built from client text. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "const re = new RegExp(input);",
|
||
"after": "const found = text.includes(input);",
|
||
"fix": "Use includes for literal search; bound regex grammar/complexity and input when regex is a feature. A Promise timeout cannot interrupt synchronous regex execution.",
|
||
"check": "Long near-matches cannot block the event loop; Unicode/case semantics remain compatible.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-regex-dynamic",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "resource-limits",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-LOOSE-COMPARE",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "Loose comparison of token or signature",
|
||
"engine": "regex",
|
||
"pattern": "\\$(?:token|signature|hash|password|digest)\\b\\s*(?:==|!=)(?!=)",
|
||
"reason": "Review signal: Loose comparison of token or signature. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "$ok = $token == $provided;",
|
||
"after": "$ok = is_string($provided) && hash_equals($token, $provided);",
|
||
"fix": "Validate types; use hash_equals for tags, === for ordinary values and password_verify for passwords. Numeric-string semantics depend on version/operands.",
|
||
"check": "Numbers, arrays and numeric strings cannot grant access; valid values work.",
|
||
"doc": "docs/vulnerabilities/php.md#php-loose-compare",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-UPLOAD",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "Moving an uploaded file",
|
||
"engine": "regex",
|
||
"pattern": "\\bmove_uploaded_file\\s*\\(",
|
||
"reason": "Review signal: Moving an uploaded file. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "move_uploaded_file($tmp, $webroot . $name);",
|
||
"after": "move_uploaded_file($validatedTmp, $serverChosenPrivatePath);",
|
||
"fix": "Check upload error/size/type; use non-overwriting server-generated names outside executable web roots and authorize downloads.",
|
||
"check": "Test upload/download, collisions, wrong owner/type and full disk. The call remains a review signal.",
|
||
"doc": "docs/vulnerabilities/php.md#php-upload",
|
||
"review_after": true,
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-434"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-DISPLAY-ERRORS",
|
||
"languages": [
|
||
"php",
|
||
"config"
|
||
],
|
||
"title": "PHP displays errors to clients",
|
||
"engine": "regex",
|
||
"pattern": "\\bdisplay_errors\\s*(?:=|,)\\s*[\"']?(?:On|1|true)\\b",
|
||
"reason": "Review signal: PHP displays errors to clients. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "display_errors = On",
|
||
"after": "display_errors = Off",
|
||
"fix": "Disable client error output and retain redacted local logs; check effective php.ini/FPM and runtime ini_set.",
|
||
"check": "Parse/database/type errors yield expected public responses while private diagnostics remain.",
|
||
"doc": "docs/vulnerabilities/php.md#php-display-errors",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "information-disclosure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-PPROF",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "pprof registered on an HTTP mux",
|
||
"engine": "regex",
|
||
"pattern": "[\"]net/http/pprof[\"]",
|
||
"reason": "Review signal: pprof registered on an HTTP mux. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "import _ \"net/http/pprof\"",
|
||
"after": "// use a separate authenticated diagnostics mux when diagnostics is required",
|
||
"fix": "Do not expose DefaultServeMux debug handlers as the business API; separate muxes and authorize diagnostic endpoints.",
|
||
"check": "Normal API works; anonymous clients cannot obtain profiles/heap. Import alone does not prove exposure.",
|
||
"doc": "docs/vulnerabilities/go.md#go-pprof",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-FILESERVER",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "FileServer publishes a file tree",
|
||
"engine": "regex",
|
||
"pattern": "\\bhttp\\.(?:FileServer|FileServerFS)\\s*\\(",
|
||
"reason": "Review signal: FileServer publishes a file tree. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "http.Handle(\"/\", http.FileServer(http.Dir(\".\")))",
|
||
"after": "http.Handle(\"/assets/\", http.StripPrefix(\"/assets/\", http.FileServer(http.Dir(\"./public\"))))",
|
||
"fix": "Use a dedicated public root without secrets/databases; authorize private files separately and review symlinks/listing.",
|
||
"check": "Assets work; .env, source, foreign files and outward symlinks are unavailable.",
|
||
"doc": "docs/vulnerabilities/go.md#go-fileserver",
|
||
"review_after": true,
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-22"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-JACKSON-TYPES",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "Jackson default typing",
|
||
"engine": "regex",
|
||
"pattern": "\\.(?:enableDefaultTyping|activateDefaultTyping)\\s*\\(",
|
||
"reason": "Review signal: Jackson default typing. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "mapper.enableDefaultTyping();",
|
||
"after": "// deserialize into a fixed DTO without client-selected implementation types",
|
||
"fix": "Prefer explicit DTOs; required polymorphism needs a narrow type set/validator for the installed version, not a package-wide allowlist.",
|
||
"check": "Unknown types fail before side effects; valid documents remain readable.",
|
||
"doc": "docs/vulnerabilities/java.md#java-jackson-types",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-502"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-XML",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "XML parser needs an external-resource policy",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:DocumentBuilderFactory|SAXParserFactory|XMLInputFactory|TransformerFactory)\\.newInstance\\s*\\(",
|
||
"reason": "Review signal: XML parser needs an external-resource policy. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "var f = DocumentBuilderFactory.newInstance();",
|
||
"after": "var f = DocumentBuilderFactory.newInstance();\nf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, \"\");\nf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, \"\");\n// also configure DTD/entity policy and parser-specific limits",
|
||
"fix": "Restrict DTD/entities/schema/XSLT on the actual factory and set limits; never silently ignore unsupported security options.",
|
||
"check": "Parser reads no external files/URLs; ordinary XML and size limits work.",
|
||
"doc": "docs/vulnerabilities/java.md#java-xml",
|
||
"review_after": true,
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-611"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-EXPRESSION",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "Client text parsed as SpEL",
|
||
"engine": "regex",
|
||
"pattern": "\\.parseExpression\\s*\\(",
|
||
"reason": "Review signal: Client text parsed as SpEL. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "parser.parseExpression(input).getValue(context);",
|
||
"after": "lookupAllowedOperation(operationId, validatedArguments);",
|
||
"fix": "Use fixed operations/arguments or a restricted DSL and evaluation context; never expose arbitrary reflection.",
|
||
"check": "Disallowed operations cannot reach runtime; approved calculations work.",
|
||
"doc": "docs/vulnerabilities/java.md#java-expression",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-94"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-PROCESS",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": ".NET process creation",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:new\\s+ProcessStartInfo|Process\\.Start)\\s*\\(",
|
||
"reason": "Review signal: .NET process creation. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "Process.Start(\"sh\", \"-c \" + command);",
|
||
"after": "var digest = SHA256.HashData(Encoding.UTF8.GetBytes(text));",
|
||
"fix": "Prefer a library operation or fixed executable plus ArgumentList. UseShellExecute=false does not neutralize explicit sh/cmd or option injection.",
|
||
"check": "Quotes stay data and expected output format is preserved.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-process",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-IGNORE-FILTERS",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "Global query filters disabled",
|
||
"engine": "regex",
|
||
"pattern": "\\.IgnoreQueryFilters\\s*\\(",
|
||
"reason": "Review signal: Global query filters disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "var rows = db.Notes.IgnoreQueryFilters().ToList();",
|
||
"after": "var rows = db.Notes.Where(n => n.OwnerId == userId).ToList();",
|
||
"fix": "Do not disable tenant/auth filters merely for soft-delete; admin bypass requires explicit authorization and query restrictions.",
|
||
"check": "Test two tenants, deleted records and exports against the actual provider SQL.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-ignore-filters",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-ALLOWANON",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "AllowAnonymous route",
|
||
"engine": "regex",
|
||
"pattern": "\\[\\s*AllowAnonymous(?:Attribute)?\\s*\\]",
|
||
"reason": "Review signal: AllowAnonymous route. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "[AllowAnonymous]\npublic IActionResult PrivateNote() => View();",
|
||
"after": "[Authorize]\npublic IActionResult PrivateNote() => View();",
|
||
"fix": "Review effective endpoint metadata/ownership; AllowAnonymous may override Authorize. Login/health may be intentionally public.",
|
||
"check": "Public login works; private endpoints and nested operations require authorization.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-allowanon",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-PERMIT-ALL",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Rails permits all parameters",
|
||
"engine": "regex",
|
||
"pattern": "\\.permit!|\\bpermit_all_parameters\\s*=\\s*true\\b",
|
||
"reason": "Review signal: Rails permits all parameters. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "attrs = params.permit!",
|
||
"after": "attrs = params.require(:note).permit(:title, :body)",
|
||
"fix": "Allowlist editable fields; choose owner/role server-side and constrain nested params separately.",
|
||
"check": "Owner/role/unknown nested fields do not apply; valid partial edits work.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-permit-all",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-CONSTANTIZE",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "String selects a Ruby class",
|
||
"engine": "regex",
|
||
"pattern": "\\.(?:safe_constantize|constantize)\\b",
|
||
"reason": "Review signal: String selects a Ruby class. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "klass = params[:type].constantize",
|
||
"after": "klass = {\"text\" => TextNote}.fetch(validated_type)",
|
||
"fix": "Use a fixed map of allowed DTO types; safe_constantize only changes lookup errors, not the allowed classes.",
|
||
"check": "Unknown types cannot create objects; valid types remain compatible.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-constantize",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-HTML-SAFE",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Ruby html_safe/raw",
|
||
"engine": "regex",
|
||
"pattern": "\\.html_safe\\b|\\braw\\s*\\(",
|
||
"reason": "Review signal: Ruby html_safe/raw. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "value = params[:text].html_safe",
|
||
"after": "value = params[:text] # render with automatic escaping",
|
||
"fix": "Use context-appropriate autoescape or a sanitizer for permitted HTML; HTML data is not ERB source.",
|
||
"check": "Tags/quotes remain text and approved formatting works.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-html-safe",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-SQL",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Ruby SQL interpolation",
|
||
"engine": "regex",
|
||
"pattern": "\\.(?:where|find_by_sql|order)\\s*\\(\\s*\"[^\"\\n]{0,400}#\\{",
|
||
"reason": "Review signal: Ruby SQL interpolation. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "Note.where(\"title = '#{title}'\")",
|
||
"after": "Note.where(title: title, owner_id: current_user.id)",
|
||
"fix": "Bind values with the ORM/driver API; select identifiers from a server allowlist.",
|
||
"check": "Quotes remain values and tenant/owner conditions hold.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-sql",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-89"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUST-STATIC-MUT",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"title": "Shared mutable Rust state",
|
||
"engine": "regex",
|
||
"pattern": "\\bstatic\\s+mut\\b",
|
||
"reason": "Review signal: Shared mutable Rust state. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "static mut CURRENT_USER: u64 = 0;",
|
||
"after": "static CURRENT_USER: std::sync::Mutex<u64> = std::sync::Mutex::new(0);",
|
||
"fix": "Use ownership or synchronized primitives with clear invariants; review all unsafe accesses and cross-request state.",
|
||
"check": "Concurrent requests do not race or leak another user's data; ordinary operations work.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-static-mut",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-ATOI",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "atoi without checked conversion",
|
||
"engine": "regex",
|
||
"pattern": "\\b(?:atoi|atol|atoll)\\s*\\(",
|
||
"reason": "Review signal: atoi without checked conversion. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "int size = atoi(input);",
|
||
"after": "// use strtol/strtoull with errno, end pointer, sign and application bounds checks",
|
||
"fix": "Use checked conversion with end-pointer, range and errno validation; define the accepted numeric grammar.",
|
||
"check": "Empty, trailing junk, signs and overflow fail; permitted boundary values work.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-atoi",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-REALLOC",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "Overwriting the only pointer with realloc",
|
||
"engine": "regex",
|
||
"pattern": "\\b([A-Za-z_]\\w*)\\s*=\\s*realloc\\s*\\(\\s*\\1\\s*,",
|
||
"reason": "Review signal: Overwriting the only pointer with realloc. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "buffer = realloc(buffer, size);",
|
||
"after": "void *next = realloc(buffer, size);\nif (next == NULL) { /* preserve buffer; handle error */ }\nelse { buffer = next; }",
|
||
"fix": "Keep the original pointer until allocation succeeds; handle zero size and overflow according to the intended contract.",
|
||
"check": "Allocation failure leaks no original allocation and does not cause invalid access.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-realloc",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CFG-NGINX-AUTH-OFF",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"title": "Nested nginx location disables auth_request",
|
||
"engine": "regex",
|
||
"pattern": "\\bauth_request\\s+off\\s*;",
|
||
"reason": "Review signal: Nested nginx location disables auth_request. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"before": "location /export/ { auth_request off; }",
|
||
"after": "location /export/ { auth_request /verify; }",
|
||
"fix": "Review location selection/inheritance and remove unintended auth bypass while preserving intended public endpoints.",
|
||
"check": "Protected resources require authentication through every matching location; health/login works.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-nginx-auth-off",
|
||
"limitations": "Bounded textual heuristic, not a language parser or taint analysis. Comments, strings and same-named APIs can match; inspect actual execution and trust boundaries.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "PY-SSL-CONTEXT",
|
||
"title": "TLS context verification disabled",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "import ssl\ncontext = ssl._create_unverified_context()",
|
||
"after": "import ssl\ncontext = ssl.create_default_context(cafile=trusted_ca_file)",
|
||
"reason": "Review signal: TLS context verification disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Enable certificate/hostname verification and configure the correct CA rather than an unverified context.",
|
||
"check": "Correct peers work; wrong CA/hostname and expiry fail.",
|
||
"doc": "docs/vulnerabilities/python.md#py-ssl-context",
|
||
"detection": "AST: ssl._create_unverified_context(), verify_mode=ssl.CERT_NONE and check_hostname=False assignments with import aliases. Assignment receiver type is not established.",
|
||
"references": [
|
||
"https://docs.python.org/3/library/ssl.html#security-considerations"
|
||
],
|
||
"limitations": "AST: ssl._create_unverified_context(), verify_mode=ssl.CERT_NONE and check_hostname=False assignments with import aliases. Assignment receiver type is not established.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-CSRF-EXEMPT",
|
||
"title": "Django view excluded from CSRF",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "from django.views.decorators.csrf import csrf_exempt\n@csrf_exempt\ndef update(request):\n return change_profile(request)",
|
||
"after": "from django.views.decorators.csrf import csrf_protect\n@csrf_protect\ndef update(request):\n return change_profile(request)",
|
||
"reason": "Review signal: Django view excluded from CSRF. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Retain CSRF on cookie-authenticated browser routes; narrow exemptions to independently authenticated stateless endpoints.",
|
||
"check": "Browser mutations need the correct token; authorized API/webhook requests still work.",
|
||
"doc": "docs/vulnerabilities/python.md#py-csrf-exempt",
|
||
"detection": "AST: django.views.decorators.csrf.csrf_exempt decorator/call with import alias. An exemption alone is not proof of a flaw on a bearer-only endpoint.",
|
||
"references": [
|
||
"https://docs.djangoproject.com/en/5.2/ref/csrf/"
|
||
],
|
||
"limitations": "AST: django.views.decorators.csrf.csrf_exempt decorator/call with import alias. An exemption alone is not proof of a flaw on a bearer-only endpoint.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-MASS-ASSIGN",
|
||
"title": "Request fields become model attributes",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "for field, value in payload.items():\n setattr(account, field, value)",
|
||
"after": "account.display_name = validate_display_name(payload['display_name'])",
|
||
"reason": "Review signal: Request fields become model attributes. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Explicitly allowlist editable attributes; derive owner/role and nested privileges server-side.",
|
||
"check": "Unknown/admin fields do not alter state; permitted edits remain functional.",
|
||
"doc": "docs/vulnerabilities/python.md#py-mass-assign",
|
||
"detection": "AST: setattr with nonliteral attribute name. **kwargs, wrappers, ORM update and constructors are not automatically covered.",
|
||
"limitations": "AST: setattr with nonliteral attribute name. **kwargs, wrappers, ORM update and constructors are not automatically covered.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-REDIRECT",
|
||
"title": "Dynamic redirect destination",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "from flask import redirect\nreturn_url = request.args['next']\nresponse = redirect(return_url)",
|
||
"after": "from flask import redirect\nresponse = redirect('/profile')",
|
||
"reason": "Review signal: Dynamic redirect destination. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Resolve destinations from an allowlist or verify approved scheme/host/path after normalization; do not trust user-controlled return URLs.",
|
||
"check": "External, scheme-relative and malformed destinations fail; supported navigation works.",
|
||
"doc": "docs/vulnerabilities/python.md#py-redirect",
|
||
"detection": "AST: flask.redirect/werkzeug.utils.redirect first argument or location=; django.shortcuts.redirect first argument or to=. Import aliases/inline **dict supported; literals or known simple scalar values do not signal. Review trust, wrappers, runtime kwargs, route resolution and reverse-proxy redirects.",
|
||
"references": [
|
||
"https://flask.palletsprojects.com/en/stable/api/#flask.redirect",
|
||
"https://werkzeug.palletsprojects.com/en/stable/utils/#werkzeug.utils.redirect",
|
||
"https://docs.djangoproject.com/en/stable/topics/http/shortcuts/#redirect"
|
||
],
|
||
"limitations": "AST: flask.redirect/werkzeug.utils.redirect first argument or location=; django.shortcuts.redirect first argument or to=. Import aliases/inline **dict supported; literals or known simple scalar values do not signal. Review trust, wrappers, runtime kwargs, route resolution and reverse-proxy redirects.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-JWT-ALGORITHMS",
|
||
"title": "JWT algorithms taken from an expression",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "import jwt\nclaims = jwt.decode(token, key, algorithms=[header['alg']])",
|
||
"after": "import jwt\nclaims = jwt.decode(token, key, algorithms=['RS256'], audience='notes', issuer='auth')",
|
||
"reason": "Review signal: JWT algorithms taken from an expression. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Bind allowed algorithms to trusted key configuration; never mix HMAC/RSA for the same key material.",
|
||
"check": "Wrong algorithm/key type/signature fails; issuer, audience and expiry are checked.",
|
||
"doc": "docs/vulnerabilities/python.md#py-jwt-algorithms",
|
||
"detection": "AST: algorithms outside an inline list/tuple of strings; exact jose.jwt.decode also permits known literal/scalar strings. Only jose.jwt.decode and jwt.decode_complete use third positional algorithms; generic jwt.decode uses keyword only. Explicit None signals; missing arguments, *args, mutable config, version and allowlist origin need review. Explicit duplicate algorithms/options arguments are not analyzed as executable calls.",
|
||
"references": [
|
||
"https://github.com/mpdavis/python-jose/blob/3.5.0/jose/jwt.py",
|
||
"https://github.com/jpadilla/pyjwt/blob/2.10.1/jwt/api_jwt.py",
|
||
"https://github.com/jpadilla/pyjwt/blob/1.7.1/jwt/api_jwt.py"
|
||
],
|
||
"limitations": "AST: algorithms outside an inline list/tuple of strings; exact jose.jwt.decode also permits known literal/scalar strings. Only jose.jwt.decode and jwt.decode_complete use third positional algorithms; generic jwt.decode uses keyword only. Explicit None signals; missing arguments, *args, mutable config, version and allowlist origin need review. Explicit duplicate algorithms/options arguments are not analyzed as executable calls.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-JWT-CLAIMS",
|
||
"title": "JWT expiry or recipient checks disabled",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "import jwt\nclaims = jwt.decode(token, key, algorithms=['HS256'], options={'verify_exp': False})",
|
||
"after": "import jwt\nclaims = jwt.decode(token, key, algorithms=['HS256'], audience='notes', issuer='auth', options={'require': ['exp', 'sub', 'iss', 'aud']})",
|
||
"reason": "Review signal: JWT expiry or recipient checks disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Validate expiry, issuer, audience and required presence separately. The after example uses PyJWT 2.x options.require; python-jose uses require_*. Check decode_complete's result shape.",
|
||
"check": "Expired, premature, missing-claim and other-application tokens fail; sessions work with the selected library/result shape.",
|
||
"doc": "docs/vulnerabilities/python.md#py-jwt-claims",
|
||
"detection": "AST: inline options with verify_exp/verify_nbf/verify_aud/verify_iss=False, scalar booleans and inline spreads. Only jose.jwt.decode/jwt.decode_complete consider fourth positional options. Only jose.jwt.decode require_X=True suppresses corresponding verify_X=False, not other claims/signature. Review external dictionaries, *args, duplicates, instance config, versions and required presence.",
|
||
"references": [
|
||
"https://github.com/mpdavis/python-jose/blob/3.5.0/jose/jwt.py",
|
||
"https://github.com/jpadilla/pyjwt/blob/2.10.1/jwt/api_jwt.py",
|
||
"https://github.com/jpadilla/pyjwt/blob/1.7.1/jwt/api_jwt.py"
|
||
],
|
||
"limitations": "AST: inline options with verify_exp/verify_nbf/verify_aud/verify_iss=False, scalar booleans and inline spreads. Only jose.jwt.decode/jwt.decode_complete consider fourth positional options. Only jose.jwt.decode require_X=True suppresses corresponding verify_X=False, not other claims/signature. Review external dictionaries, *args, duplicates, instance config, versions and required presence.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-REGEX-DYNAMIC",
|
||
"title": "Dynamic regular-expression pattern",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"engine": "python-ast",
|
||
"before": "import re\nfound = re.search(request_pattern, text)",
|
||
"after": "import re\nfound = re.search(re.escape(search_text), bounded_text)",
|
||
"reason": "Review signal: Dynamic regular-expression pattern. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "For literal search use escaping/string operations; a regex feature needs constrained grammar, lengths and execution budget.",
|
||
"check": "Metacharacters stay literal where intended; long near-matches cannot block the handler.",
|
||
"doc": "docs/vulnerabilities/python.md#py-regex-dynamic",
|
||
"detection": "AST: re.compile/match/search/fullmatch/findall/finditer/split/sub/subn with nonliteral first argument. Does not measure regex complexity; safe re.escape still signals.",
|
||
"review_after": true,
|
||
"references": [
|
||
"https://docs.python.org/3/library/re.html#re.escape"
|
||
],
|
||
"limitations": "AST: re.compile/match/search/fullmatch/findall/finditer/split/sub/subn with nonliteral first argument. Does not measure regex complexity; safe re.escape still signals.",
|
||
"family": "resource-limits",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-BUFFER-EXPOSURE",
|
||
"title": "Uninitialized Buffer exposure",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"engine": "regex",
|
||
"before": "const out = Buffer.allocUnsafe(size);\nconst n = await readInto(out);\nres.end(out);",
|
||
"after": "const out = Buffer.alloc(size);\nconst n = await readInto(out);\nres.end(out.subarray(0, n));",
|
||
"reason": "Review signal: Uninitialized Buffer exposure. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Initialize memory, emit only the written range and validate size/read results.",
|
||
"check": "Short read, EOF and errors disclose no tail bytes; valid binary responses work.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-buffer-exposure",
|
||
"detection": "Regex: Buffer.allocUnsafe/allocUnsafeSlow. Full initialization before disclosure may remove risk on review; inspect legacy new Buffer and incorrect lengths separately.",
|
||
"pattern": "\\bBuffer\\s*\\.\\s*allocUnsafe(?:Slow)?\\s*\\(",
|
||
"references": [
|
||
"https://nodejs.org/api/buffer.html#what-makes-bufferallocunsafe-and-bufferallocunsafeslow-unsafe"
|
||
],
|
||
"limitations": "Regex: Buffer.allocUnsafe/allocUnsafeSlow. Full initialization before disclosure may remove risk on review; inspect legacy new Buffer and incorrect lengths separately.",
|
||
"family": "information-disclosure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-JWT-DECODE",
|
||
"title": "JWT decoded without signature verification",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"engine": "regex",
|
||
"before": "const user = jwt.decode(token);\nloadNotes(user.sub);",
|
||
"after": "const claims = jwt.verify(token, key, { algorithms: ['RS256'], issuer: 'auth', audience: 'notes' });\nloadNotes(claims.sub);",
|
||
"reason": "Review signal: JWT decoded without signature verification. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Verify signature and claims before access; await asynchronous verification and reject errors before proceeding.",
|
||
"check": "Modified payload, invalid signature and wrong issuer/audience grant no access.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-jwt-decode",
|
||
"detection": "Regex: common jwt.decode/decodeJwt/jwtDecode and static ESM/CommonJS aliases for jsonwebtoken.decode/jose.decodeJwt. No scope/reassignment, re-export, dynamic import or claims-use analysis. Diagnostic decoding may be legitimate.",
|
||
"pattern": "\\b(?:(?:jwt|jsonwebtoken)\\s*\\.\\s*decode|jwtDecode|decodeJwt)\\s*\\(",
|
||
"references": [
|
||
"https://github.com/auth0/node-jsonwebtoken#jwtdecodetoken--options"
|
||
],
|
||
"limitations": "Regex: common jwt.decode/decodeJwt/jwtDecode and static ESM/CommonJS aliases for jsonwebtoken.decode/jose.decodeJwt. No scope/reassignment, re-export, dynamic import or claims-use analysis. Diagnostic decoding may be legitimate.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-JWT-OPTIONS",
|
||
"title": "Weakened JWT options",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"engine": "regex",
|
||
"before": "jwt.verify(token, key, { ignoreExpiration: true, ignoreNotBefore: true });",
|
||
"after": "jwt.verify(token, key, { algorithms: ['RS256'], issuer: 'auth', audience: 'notes' });",
|
||
"reason": "Review signal: Weakened JWT options. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Remove verification bypasses and fix algorithm/key/claims policy; require exp separately where needed.",
|
||
"check": "Expired/premature tokens and wrong algorithms/key types fail.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-jwt-options",
|
||
"detection": "Regex: ignoreExpiration/ignoreNotBefore/allowInvalidAsymmetricKeyTypes=true. Options may be separate from verify; inspect actual use.",
|
||
"pattern": "\\b(?:ignoreExpiration|ignoreNotBefore|allowInvalidAsymmetricKeyTypes)[\"\\']?\\s*:\\s*true\\b",
|
||
"references": [
|
||
"https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback"
|
||
],
|
||
"limitations": "Regex: ignoreExpiration/ignoreNotBefore/allowInvalidAsymmetricKeyTypes=true. Options may be separate from verify; inspect actual use.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-HTTP-PARSER",
|
||
"title": "Lenient Node.js HTTP parser",
|
||
"languages": [
|
||
"javascript",
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "http.createServer({ insecureHTTPParser: true }, handler);",
|
||
"after": "http.createServer({ insecureHTTPParser: false }, handler);",
|
||
"reason": "Review signal: Lenient Node.js HTTP parser. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use strict parsers on every hop and align framing/normalization; check NODE_OPTIONS and CLI flags.",
|
||
"check": "Conflicting framing fails at the first hop; valid keep-alive requests stay separate.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-http-parser",
|
||
"detection": "Regex: insecureHTTPParser:true or --insecure-http-parser. This alone does not prove request smuggling.",
|
||
"pattern": "\\binsecureHTTPParser[\"\\']?\\s*:\\s*true\\b|--insecure-http-parser\\b",
|
||
"references": [
|
||
"https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener"
|
||
],
|
||
"limitations": "Regex: insecureHTTPParser:true or --insecure-http-parser. This alone does not prove request smuggling.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JS-STATIC-DOTFILES",
|
||
"title": "Static server allows dotfiles",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"engine": "regex",
|
||
"before": "app.use(express.static(root, { dotfiles: 'allow' }));",
|
||
"after": "app.use(express.static(publicDir, { dotfiles: 'deny' }));",
|
||
"reason": "Review signal: Static server allows dotfiles. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use a dedicated public root and deny dotfiles; allow required .well-known resources narrowly without secrets.",
|
||
"check": "Assets work; dotfiles, backups and files outside the root are unavailable.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-static-dotfiles",
|
||
"detection": "Regex: dotfiles:allow. Does not check actual root, middleware order, non-dot backups or symlinks.",
|
||
"pattern": "\\bdotfiles[\"\\']?\\s*:\\s*[\"\\']allow[\"\\']",
|
||
"references": [
|
||
"https://expressjs.com/en/4x/api.html#express.static"
|
||
],
|
||
"limitations": "Regex: dotfiles:allow. Does not check actual root, middleware order, non-dot backups or symlinks.",
|
||
"family": "file-access",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-EXTRACT",
|
||
"title": "extract overwrites local variables",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"engine": "regex",
|
||
"before": "extract($_POST);\nif ($is_admin) { show_private_data(); }",
|
||
"after": "$display_name = validate_display_name($_POST['display_name'] ?? '');",
|
||
"reason": "Review signal: extract overwrites local variables. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Read explicit allowed fields. EXTR_SKIP reduces overwrites but does not replace schema/type and new-name controls.",
|
||
"check": "Input is_admin/owner/config cannot alter access; approved values retain types.",
|
||
"doc": "docs/vulnerabilities/php.md#php-extract",
|
||
"detection": "Regex: any extract(...); trusted template contexts need manual classification.",
|
||
"pattern": "\\bextract\\s*\\(",
|
||
"references": [
|
||
"https://www.php.net/manual/en/function.extract.php"
|
||
],
|
||
"limitations": "Regex: any extract(...); trusted template contexts need manual classification.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-XML-FLAGS",
|
||
"title": "XML entity substitution or DTD enabled",
|
||
"languages": [
|
||
"php",
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "$doc->loadXML($xml, LIBXML_NOENT | LIBXML_DTDLOAD | LIBXML_NONET);",
|
||
"after": "$doc->resolveExternals = false;\n$doc->substituteEntities = false;\n$doc->loadXML($boundedXml, LIBXML_NONET);",
|
||
"reason": "Review signal: XML entity substitution or DTD enabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Disable entity substitution/external DTD loading, bound input and check libxml version. Use LIBXML_NO_XXE where supported; NONET alone is insufficient.",
|
||
"check": "Ordinary XML works; entities/DTD read no files or network and nesting/size are limited.",
|
||
"doc": "docs/vulnerabilities/php.md#php-xml-flags",
|
||
"detection": "Regex: LIBXML_NOENT/DTDLOAD/DTDATTR/DTDVALID and substituteEntities/resolveExternals=true. Numeric ini/database masks are not decoded; inspect bits against runtime constants.",
|
||
"pattern": "\\bLIBXML_(?:NOENT|DTDLOAD|DTDATTR|DTDVALID)\\b|\\b(?:substituteEntities|resolveExternals)\\s*=\\s*true\\b",
|
||
"references": [
|
||
"https://www.php.net/manual/en/libxml.constants.php",
|
||
"https://github.com/enowars/enowars7-service-oldschool#vulnerabilities"
|
||
],
|
||
"limitations": "Regex: LIBXML_NOENT/DTDLOAD/DTDATTR/DTDVALID and substituteEntities/resolveExternals=true. Numeric ini/database masks are not decoded; inspect bits against runtime constants.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-611"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-TEMPLATE",
|
||
"title": "Template built from dynamic text",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"engine": "regex",
|
||
"before": "$template = $twig->createTemplate($profileText);\necho $template->render($vars);",
|
||
"after": "echo $twig->render('profile.html.twig', ['about' => $profileText]);",
|
||
"reason": "Review signal: Template built from dynamic text. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Separate trusted template source from values; user templates need explicit sandbox/loader/function/resource policy.",
|
||
"check": "Profile template expressions remain data; private templates/files are unavailable.",
|
||
"doc": "docs/vulnerabilities/php.md#php-template",
|
||
"detection": "Regex: createTemplate($...) and Smarty display/fetch with eval: or string:. Inspect variable loaders, custom filters and database templates.",
|
||
"pattern": "\\bcreateTemplate\\s*\\(\\s*\\$|->\\s*(?:fetch|display)\\s*\\(\\s*[\"\\'](?:eval|string):",
|
||
"references": [
|
||
"https://twig.symfony.com/doc/3.x/api.html#loading-templates-from-a-string"
|
||
],
|
||
"limitations": "Regex: createTemplate($...) and Smarty display/fetch with eval: or string:. Inspect variable loaders, custom filters and database templates.",
|
||
"family": "injection",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-CURL-TLS",
|
||
"title": "cURL certificate or hostname checks disabled",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"engine": "regex",
|
||
"before": "curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\ncurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);",
|
||
"after": "curl_setopt_array($ch, [CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_CAINFO => $trustedCA]);",
|
||
"reason": "Review signal: cURL certificate or hostname checks disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Verify peer and hostname with the trusted CA; use VERIFYHOST=2, not historical ambiguous 1.",
|
||
"check": "Correct CA/host works; wrong CA/host and expiry fail without fallback.",
|
||
"doc": "docs/vulnerabilities/php.md#php-curl-tls",
|
||
"detection": "Regex: CURLOPT_SSL_VERIFYPEER=false/0 and CURLOPT_SSL_VERIFYHOST=false/0/1 in arguments/setopt_array. Variable values are not evaluated.",
|
||
"pattern": "\\b(?:CURLOPT_SSL_VERIFYPEER\\s*(?:,|=>)\\s*(?:false|0)\\b|CURLOPT_SSL_VERIFYHOST\\s*(?:,|=>)\\s*(?:false|[01])\\b)",
|
||
"references": [
|
||
"https://www.php.net/manual/en/function.curl-setopt.php"
|
||
],
|
||
"limitations": "Regex: CURLOPT_SSL_VERIFYPEER=false/0 and CURLOPT_SSL_VERIFYHOST=false/0/1 in arguments/setopt_array. Variable values are not evaluated.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-URL-INCLUDE",
|
||
"title": "Remote resource inclusion enabled",
|
||
"languages": [
|
||
"config",
|
||
"php"
|
||
],
|
||
"engine": "regex",
|
||
"before": "allow_url_include = On",
|
||
"after": "allow_url_include = Off",
|
||
"reason": "Review signal: Remote resource inclusion enabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Disable allow_url_include in the effective SAPI config; select include paths from a closed server-side map.",
|
||
"check": "Normal modules load; client URLs cannot become executable code.",
|
||
"doc": "docs/vulnerabilities/php.md#php-url-include",
|
||
"detection": "Regex: allow_url_include=On/1/true in ini/config/assignment. Review runtime overrides and effective include paths separately.",
|
||
"pattern": "\\ballow_url_include[\"\\']?\\s*[:=]\\s*[\"\\']?(?:on|true|1)\\b",
|
||
"references": [
|
||
"https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include"
|
||
],
|
||
"limitations": "Regex: allow_url_include=On/1/true in ini/config/assignment. Review runtime overrides and effective include paths separately.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PHP-SESSION-CONFIG",
|
||
"title": "Weakened PHP session configuration",
|
||
"languages": [
|
||
"config",
|
||
"php"
|
||
],
|
||
"engine": "regex",
|
||
"before": "session.use_strict_mode = 0\nsession.use_only_cookies = 0\nsession.use_trans_sid = 1",
|
||
"after": "session.use_strict_mode = 1\nsession.use_only_cookies = 1\nsession.use_trans_sid = 0",
|
||
"reason": "Review signal: Weakened PHP session configuration. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Enable strict mode and cookie-only transport, disable URL rewriting and regenerate IDs at login; review custom handlers/cookies.",
|
||
"check": "Unknown fixed IDs fail, login changes the ID, URLs/logs contain no IDs and sessions work.",
|
||
"doc": "docs/vulnerabilities/php.md#php-session-config",
|
||
"detection": "Regex: explicit unsafe use_strict_mode/use_only_cookies/use_trans_sid values. Missing settings and ini_set argument forms need manual review.",
|
||
"pattern": "\\bsession\\.(?:(?:use_strict_mode|use_only_cookies)[\"\\']?\\s*[:=]\\s*[\"\\']?(?:0|off|false)\\b|use_trans_sid[\"\\']?\\s*[:=]\\s*[\"\\']?(?:1|on|true)\\b)",
|
||
"references": [
|
||
"https://www.php.net/manual/en/session.configuration.php"
|
||
],
|
||
"limitations": "Regex: explicit unsafe use_strict_mode/use_only_cookies/use_trans_sid values. Missing settings and ini_set argument forms need manual review.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-TLS-MIN",
|
||
"title": "Obsolete minimum TLS version",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"engine": "regex",
|
||
"before": "cfg := &tls.Config{MinVersion: tls.VersionTLS10}",
|
||
"after": "cfg := &tls.Config{MinVersion: tls.VersionTLS12}",
|
||
"reason": "Review signal: Obsolete minimum TLS version. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Choose TLS 1.2/1.3 minimum compatible with checker/peers while retaining certificate checks.",
|
||
"check": "Normal peers connect; versions below the chosen minimum fail.",
|
||
"doc": "docs/vulnerabilities/go.md#go-tls-min",
|
||
"detection": "Regex: MinVersion:tls.VersionSSL30/TLS10/TLS11 and assignments, including newlines; ==, !=, TLS12/TLS13 and 0 do not signal. SSL30 is obsolete and unsupported by modern Go. Review object/effective config/version; numbers, aliases, variables and external listener settings are not evaluated.",
|
||
"pattern": "(?:\\bMinVersion\\s*:|\\.\\s*MinVersion\\s*=(?!=))\\s*(?:tls\\.)?Version(?:SSL30|TLS10|TLS11)\\b",
|
||
"references": [
|
||
"https://pkg.go.dev/crypto/tls#Config",
|
||
"https://github.com/golang/go/blob/go1.24.0/src/crypto/tls/common.go#L756"
|
||
],
|
||
"limitations": "Regex: MinVersion:tls.VersionSSL30/TLS10/TLS11 and assignments, including newlines; ==, !=, TLS12/TLS13 and 0 do not signal. SSL30 is obsolete and unsupported by modern Go. Review object/effective config/version; numbers, aliases, variables and external listener settings are not evaluated.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "GO-JWT-UNVERIFIED",
|
||
"title": "JWT without signature or claims verification",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"engine": "regex",
|
||
"before": "token, _, err := parser.ParseUnverified(raw, &claims)",
|
||
"after": "token, err := jwt.ParseWithClaims(raw, &claims, trustedKeyFunc, jwt.WithValidMethods([]string{\"RS256\"}), jwt.WithIssuer(\"auth\"), jwt.WithAudience(\"notes\"), jwt.WithExpirationRequired())\nif err != nil || !token.Valid { return ErrUnauthorized }",
|
||
"reason": "Review signal: JWT without signature or claims verification. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use a validating API with trusted keyfunc, algorithms and claims; check err before using token/claims.",
|
||
"check": "Signature/expiry/audience checks work, error nil tokens do not panic and valid tokens pass.",
|
||
"doc": "docs/vulnerabilities/go.md#go-jwt-unverified",
|
||
"detection": "Regex: ParseUnverified and WithoutClaimsValidation; does not prove authentication uses the result. The example targets golang-jwt/jwt/v5.",
|
||
"pattern": "\\b(?:ParseUnverified|WithoutClaimsValidation)\\s*\\(",
|
||
"references": [
|
||
"https://pkg.go.dev/github.com/golang-jwt/jwt/v5"
|
||
],
|
||
"limitations": "Regex: ParseUnverified and WithoutClaimsValidation; does not prove authentication uses the result. The example targets golang-jwt/jwt/v5.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-JNDI",
|
||
"title": "Dynamic JNDI lookup name",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"engine": "regex",
|
||
"before": "Object value = context.lookup(requestName);",
|
||
"after": "Object value = context.lookup(\"java:comp/env/jdbc/Notes\");",
|
||
"reason": "Review signal: Dynamic JNDI lookup name. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use a closed map of trusted local names and restrict providers; JDK updates do not replace input validation.",
|
||
"check": "Valid resources resolve; unknown/external names cannot initiate lookups or change backend.",
|
||
"doc": "docs/vulnerabilities/java.md#java-jndi",
|
||
"detection": "Regex: InitialContext.doLookup or ctx/context/initialContext.lookup with a non-string argument. Inspect arbitrary receiver names and indirect calls manually.",
|
||
"pattern": "\\b(?:InitialContext\\s*\\.\\s*doLookup|(?:ctx|context|initialContext)\\s*\\.\\s*lookup)\\s*\\(\\s*(?![\"\\'\\s])[\\w$]",
|
||
"references": [
|
||
"https://docs.oracle.com/en/java/javase/21/docs/api/java.naming/javax/naming/InitialContext.html"
|
||
],
|
||
"limitations": "Regex: InitialContext.doLookup or ctx/context/initialContext.lookup with a non-string argument. Inspect arbitrary receiver names and indirect calls manually.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-HOSTNAME-VERIFY",
|
||
"title": "Hostname verifier accepts every peer",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"engine": "regex",
|
||
"before": "builder.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE);",
|
||
"after": "builder.setSSLHostnameVerifier(new DefaultHostnameVerifier());",
|
||
"reason": "Review signal: Hostname verifier accepts every peer. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Restore the default verifier and trusted store instead of always-true callbacks.",
|
||
"check": "Trusted CA certificates for another host fail; the intended endpoint works.",
|
||
"doc": "docs/vulnerabilities/java.md#java-hostname-verify",
|
||
"detection": "Regex: NoopHostnameVerifier/ALLOW_ALL_HOSTNAME_VERIFIER and setHostnameVerifier with a simple true-lambda. Review complex callbacks and TrustManager separately.",
|
||
"pattern": "\\b(?:NoopHostnameVerifier|ALLOW_ALL_HOSTNAME_VERIFIER)\\b|\\bset(?:Default)?HostnameVerifier\\s*\\(\\s*\\([^)]{0,120}\\)\\s*->\\s*true\\b",
|
||
"references": [
|
||
"https://hc.apache.org/httpcomponents-client-5.5.x/current/httpclient5/apidocs/org/apache/hc/client5/http/ssl/NoopHostnameVerifier.html"
|
||
],
|
||
"limitations": "Regex: NoopHostnameVerifier/ALLOW_ALL_HOSTNAME_VERIFIER and setHostnameVerifier with a simple true-lambda. Review complex callbacks and TrustManager separately.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "JAVA-SPRING-CSRF",
|
||
"title": "Spring Security CSRF disabled",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"engine": "regex",
|
||
"before": "http.csrf(csrf -> csrf.disable());",
|
||
"after": "http.csrf(Customizer.withDefaults());",
|
||
"reason": "Review signal: Spring Security CSRF disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Keep protection for browser routes; restrict exemptions to an explicit bearer/webhook contract with no cookie fallback.",
|
||
"check": "Valid CSRF requests work; cookie POST without a token fails; approved API scenarios work.",
|
||
"doc": "docs/vulnerabilities/java.md#java-spring-csrf",
|
||
"detection": "Regex: csrf().disable(), csrf(x -> x.disable()) and csrf(AbstractHttpConfigurer::disable). Review individual security chains and matchers.",
|
||
"pattern": "\\bcsrf\\s*\\(\\s*\\)\\s*\\.\\s*disable\\s*\\(|\\bcsrf\\s*\\(\\s*[\\w]+\\s*->\\s*[\\w]+\\s*\\.\\s*disable\\s*\\(|\\bcsrf\\s*\\(\\s*AbstractHttpConfigurer\\s*::\\s*disable",
|
||
"references": [
|
||
"https://docs.spring.io/spring-security/reference/servlet/exploits/csrf.html"
|
||
],
|
||
"limitations": "Regex: csrf().disable(), csrf(x -> x.disable()) and csrf(AbstractHttpConfigurer::disable). Review individual security chains and matchers.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-HTML-RAW",
|
||
"title": "HTML output without escaping",
|
||
"languages": [
|
||
"csharp",
|
||
"template"
|
||
],
|
||
"engine": "regex",
|
||
"before": "@Html.Raw(Model.About)",
|
||
"after": "@Model.About",
|
||
"reason": "Review signal: HTML output without escaping. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use regular Razor output or an allowlisted HTML sanitizer for supported rich text; consider URL/JS context.",
|
||
"check": "Untrusted tags, attributes and URLs cannot execute script; permitted text renders.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-html-raw",
|
||
"detection": "Regex: Html.Raw and new HtmlString. Sanitization is not inferred from a call; trusted static markup may be legitimate.",
|
||
"pattern": "\\bHtml\\s*\\.\\s*Raw\\s*\\(|\\bnew\\s+HtmlString\\s*\\(",
|
||
"references": [
|
||
"https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting"
|
||
],
|
||
"limitations": "Regex: Html.Raw and new HtmlString. Sanitization is not inferred from a call; trusted static markup may be legitimate.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-XML",
|
||
"title": "XML parser permits DTD or external resolver",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"engine": "regex",
|
||
"before": "var settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Parse, XmlResolver = new XmlUrlResolver() };",
|
||
"after": "var settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null, MaxCharactersInDocument = 1048576 };",
|
||
"reason": "Review signal: XML parser permits DTD or external resolver. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Prohibit DTD, remove external resolver and bound input; pass these settings to the actual XmlReader.",
|
||
"check": "Ordinary XML works; external resources/DTD fail and size is bounded.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-xml",
|
||
"detection": "Regex: DtdProcessing.Parse, XmlResolver=new XmlUrlResolver and ProhibitDtd=false. Defaults depend on framework/API; absence of a match is not proof of safety.",
|
||
"pattern": "\\bDtdProcessing\\s*=\\s*(?:[\\w.]*\\.)?DtdProcessing\\.Parse\\b|\\bXmlResolver\\s*=\\s*new\\s+(?:[\\w.]*\\.)?XmlUrlResolver\\s*\\(|\\bProhibitDtd\\s*=\\s*false\\b",
|
||
"references": [
|
||
"https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca3075"
|
||
],
|
||
"limitations": "Regex: DtdProcessing.Parse, XmlResolver=new XmlUrlResolver and ProhibitDtd=false. Defaults depend on framework/API; absence of a match is not proof of safety.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-611"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-JWT-VALIDATION",
|
||
"title": "Weakened .NET token validation",
|
||
"languages": [
|
||
"csharp",
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "new TokenValidationParameters { ValidateLifetime = false, ValidateAudience = false, RequireSignedTokens = false };",
|
||
"after": "new TokenValidationParameters { ValidateLifetime = true, ValidateAudience = true, ValidAudience = \"notes\", ValidateIssuer = true, ValidIssuer = \"auth\", RequireSignedTokens = true, RequireExpirationTime = true, IssuerSigningKey = trustedKey };",
|
||
"reason": "Review signal: Weakened .NET token validation. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Validate signature, key, time, issuer and audience; custom validators must retain these invariants.",
|
||
"check": "Unsigned, expired and foreign tokens fail; valid tokens pass.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-jwt-validation",
|
||
"detection": "Regex: explicit false for ValidateLifetime/Issuer/Audience and RequireSignedTokens/ExpirationTime. ValidateIssuerSigningKey=false alone is not treated as missing signature verification.",
|
||
"pattern": "\\b(?:ValidateLifetime|ValidateIssuer|ValidateAudience|RequireSignedTokens|RequireExpirationTime)[\"\\']?\\s*[:=]\\s*false\\b",
|
||
"references": [
|
||
"https://learn.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.tokenvalidationparameters"
|
||
],
|
||
"limitations": "Regex: explicit false for ValidateLifetime/Issuer/Audience and RequireSignedTokens/ExpirationTime. ValidateIssuerSigningKey=false alone is not treated as missing signature verification.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CS-TLS-VALIDATION",
|
||
"title": "HTTPS validation callback always accepts",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"engine": "regex",
|
||
"before": "handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;",
|
||
"after": "var handler = new HttpClientHandler();\nvar client = new HttpClient(handler);",
|
||
"reason": "Review signal: HTTPS validation callback always accepts. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use default certificate checks and trusted CA; custom trust must not unconditionally accept.",
|
||
"check": "Valid certificates work; wrong host/CA and expiry fail.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-tls-validation",
|
||
"detection": "Regex: DangerousAcceptAnyServerCertificateValidator and simple true-lambdas for certificate callbacks. Arbitrary methods and block-bodied lambdas need manual review.",
|
||
"pattern": "\\bDangerousAcceptAnyServerCertificateValidator\\b|\\b(?:ServerCertificateCustomValidationCallback|ServerCertificateValidationCallback)\\s*\\+?=\\s*\\([^)]{0,180}\\)\\s*=>\\s*true\\b",
|
||
"references": [
|
||
"https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.dangerousacceptanyservercertificatevalidator"
|
||
],
|
||
"limitations": "Regex: DangerousAcceptAnyServerCertificateValidator and simple true-lambdas for certificate callbacks. Arbitrary methods and block-bodied lambdas need manual review.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-CSRF",
|
||
"title": "Rails controller disables CSRF",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"engine": "regex",
|
||
"before": "skip_forgery_protection\nskip_before_action :verify_authenticity_token",
|
||
"after": "protect_from_forgery with: :exception",
|
||
"reason": "Review signal: Rails controller disables CSRF. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Restore browser CSRF; narrow exceptions to an independently authenticated stateless API/webhook.",
|
||
"check": "Valid POST works; missing/wrong authenticity token fails; authorized webhooks work.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-csrf",
|
||
"detection": "Regex: skip_forgery_protection, skip_before_action/filter :verify_authenticity_token and allow_forgery_protection=false. Review only/except conditions.",
|
||
"pattern": "\\bskip_forgery_protection\\b|\\bskip_before_(?:action|filter)\\s*\\(?\\s*:verify_authenticity_token\\b|\\ballow_forgery_protection\\s*=\\s*false\\b",
|
||
"references": [
|
||
"https://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html"
|
||
],
|
||
"limitations": "Regex: skip_forgery_protection, skip_before_action/filter :verify_authenticity_token and allow_forgery_protection=false. Review only/except conditions.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUBY-TLS",
|
||
"title": "Ruby HTTPS peer verification disabled",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"engine": "regex",
|
||
"before": "http.verify_mode = OpenSSL::SSL::VERIFY_NONE",
|
||
"after": "http.verify_mode = OpenSSL::SSL::VERIFY_PEER\nhttp.ca_file = trusted_ca_file",
|
||
"reason": "Review signal: Ruby HTTPS peer verification disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Restore peer/hostname checks and the trusted CA; verify actual HTTP client settings.",
|
||
"check": "Correct server works; invalid certificates cannot yield useful responses.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-tls",
|
||
"detection": "Regex: VERIFY_NONE. Does not establish whether the object is used for a real connection.",
|
||
"pattern": "\\b(?:OpenSSL::SSL::)?VERIFY_NONE\\b",
|
||
"references": [
|
||
"https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html"
|
||
],
|
||
"limitations": "Regex: VERIFY_NONE. Does not establish whether the object is used for a real connection.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUST-COMMAND",
|
||
"title": "Shell launched from Rust",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"engine": "regex",
|
||
"before": "Command::new(\"sh\").arg(\"-c\").arg(command).output()?;",
|
||
"after": "Command::new(\"/usr/bin/file\").arg(\"--\").arg(validated_name).output()?;",
|
||
"reason": "Review signal: Shell launched from Rust. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use a fixed executable, separate arguments, allowlisted options and bounded time/output.",
|
||
"check": "Metacharacters stay data; dangerous options cannot change behavior.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-command",
|
||
"detection": "Regex: Command::new with literal sh/bash/dash/zsh/cmd/powershell/pwsh. A command may be trusted; review -c, variable executables and .args.",
|
||
"pattern": "\\bCommand\\s*::\\s*new\\s*\\(\\s*\"(?:[^\"\\n]*/)?(?:sh|bash|dash|zsh|cmd(?:\\.exe)?|powershell(?:\\.exe)?|pwsh)\"",
|
||
"references": [
|
||
"https://doc.rust-lang.org/std/process/struct.Command.html"
|
||
],
|
||
"limitations": "Regex: Command::new with literal sh/bash/dash/zsh/cmd/powershell/pwsh. A command may be trusted; review -c, variable executables and .args.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-78"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUST-TLS",
|
||
"title": "Rust HTTP accepts invalid certificates",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"engine": "regex",
|
||
"before": "let client = reqwest::Client::builder().danger_accept_invalid_certs(true).build()?;",
|
||
"after": "let client = reqwest::Client::builder().add_root_certificate(trusted_ca).build()?;",
|
||
"reason": "Review signal: Rust HTTP accepts invalid certificates. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use default validation and add the internal root CA instead of bypassing checks.",
|
||
"check": "Correct CA/host works; invalid certificates/hostnames fail.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-tls",
|
||
"detection": "Regex: danger_accept_invalid_certs/hostnames(true), including reqwest/native-tls-like builders. Review variable values and custom verifiers.",
|
||
"pattern": "\\bdanger_accept_invalid_(?:certs|hostnames)\\s*\\(\\s*true\\s*\\)",
|
||
"references": [
|
||
"https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html"
|
||
],
|
||
"limitations": "Regex: danger_accept_invalid_certs/hostnames(true), including reqwest/native-tls-like builders. Review variable values and custom verifiers.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "RUST-JWT-VALIDATION",
|
||
"title": "Rust JWT checks disabled",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"engine": "regex",
|
||
"before": "validation.insecure_disable_signature_validation();\nvalidation.validate_exp = false;",
|
||
"after": "let mut validation = Validation::new(Algorithm::RS256);\nvalidation.set_audience(&[\"notes\"]);\nvalidation.set_issuer(&[\"auth\"]);\nvalidation.set_required_spec_claims(&[\"exp\", \"sub\", \"iss\", \"aud\"]);",
|
||
"reason": "Review signal: Rust JWT checks disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use verifying decode with a trusted key and Validation contract; check its result before access.",
|
||
"check": "Invalid signatures, expiry and missing required fields fail.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-jwt-validation",
|
||
"detection": "Regex: insecure_disable_signature_validation, validate_exp/validate_aud=false and legacy dangerous_*decode. API depends on jsonwebtoken version.",
|
||
"pattern": "\\binsecure_disable_signature_validation\\s*\\(|\\bvalidate_(?:exp|aud)\\s*=\\s*false\\b|\\bdangerous_(?:insecure_)?decode(?:_with_validation)?\\s*\\(",
|
||
"references": [
|
||
"https://docs.rs/jsonwebtoken/latest/jsonwebtoken/struct.Validation.html"
|
||
],
|
||
"limitations": "Regex: insecure_disable_signature_validation, validate_exp/validate_aud=false and legacy dangerous_*decode. API depends on jsonwebtoken version.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-TEMPFILE-RACE",
|
||
"title": "Temporary filename without atomic creation",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"engine": "regex",
|
||
"before": "char name[L_tmpnam];\ntmpnam(name);\nFILE *f = fopen(name, \"w\");",
|
||
"after": "char name[] = \"/tmp/app-XXXXXX\";\nint fd = mkstemp(name);\nif (fd < 0) return ERROR;\nunlink(name);\n/* use fd; close(fd) on every exit */",
|
||
"reason": "Review signal: Temporary filename without atomic creation. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Create a private file atomically, retain its fd, check errors/modes and close/remove it on all paths.",
|
||
"check": "Concurrent operations get separate fds; existing files/symlinks are not overwritten.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-tempfile-race",
|
||
"detection": "Regex: tmpnam/tempnam/mktemp. Custom filename schemes, reopening after mkstemp and directory TOCTOU need manual review.",
|
||
"pattern": "\\b(?:tmpnam|tempnam|mktemp)\\s*\\(",
|
||
"references": [
|
||
"https://pubs.opengroup.org/onlinepubs/9799919799/functions/mkstemp.html"
|
||
],
|
||
"limitations": "Regex: tmpnam/tempnam/mktemp. Custom filename schemes, reopening after mkstemp and directory TOCTOU need manual review.",
|
||
"family": "file-access",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "C-STRNCPY",
|
||
"title": "strncpy may omit NUL termination",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"engine": "regex",
|
||
"before": "strncpy(out, input, sizeof out);\nputs(out);",
|
||
"after": "size_t n = bounded_input_length;\nif (n >= sizeof out) return ERROR;\nmemcpy(out, input, n);\nout[n] = '\\0';",
|
||
"reason": "Review signal: strncpy may omit NUL termination. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Choose reject-too-long or explicit bounded truncation with NUL space; use explicit lengths for binary data.",
|
||
"check": "Test empty/capacity-1/capacity/capacity+1; truncation cannot change identity.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-strncpy",
|
||
"detection": "Regex: strncpy. Review later NUL termination and actual capacity; memcpy without length checks is not a fix.",
|
||
"pattern": "\\bstrncpy\\s*\\(",
|
||
"references": [
|
||
"https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncpy.html"
|
||
],
|
||
"limitations": "Regex: strncpy. Review later NUL termination and actual capacity; memcpy without length checks is not a fix.",
|
||
"family": "memory-safety",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SQL-SQLITE-FK",
|
||
"title": "SQLite foreign_keys explicitly disabled",
|
||
"languages": [
|
||
"sql",
|
||
"python",
|
||
"javascript",
|
||
"go",
|
||
"php",
|
||
"java",
|
||
"csharp",
|
||
"ruby",
|
||
"rust"
|
||
],
|
||
"engine": "regex",
|
||
"before": "PRAGMA foreign_keys = OFF;",
|
||
"after": "PRAGMA foreign_keys = ON;",
|
||
"reason": "Review signal: SQLite foreign_keys explicitly disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Enable FK on every connection outside transactions, verify the result and existing violations, and migrate invalid records separately.",
|
||
"check": "Every connection reports foreign_keys=1; foreign_key_check is empty and invalid owners fail.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-sqlite-fk",
|
||
"detection": "Regex: PRAGMA foreign_keys=OFF/0/false or foreign_keys(OFF/0/false). Review missing ON, pool hooks and compile options.",
|
||
"pattern": "\\bPRAGMA\\s+foreign_keys\\s*(?:=|\\()\\s*(?:OFF|0|false)\\b",
|
||
"references": [
|
||
"https://www.sqlite.org/foreignkeys.html"
|
||
],
|
||
"limitations": "Regex: PRAGMA foreign_keys=OFF/0/false or foreign_keys(OFF/0/false). Review missing ON, pool hooks and compile options.",
|
||
"family": "manual-review",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SQL-MYSQL-PRIVILEGES",
|
||
"title": "MySQL runtime user has admin privileges",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"engine": "regex",
|
||
"before": "GRANT FILE, SUPER ON *.* TO 'app'@'%';",
|
||
"after": "GRANT SELECT, INSERT, UPDATE, DELETE ON appdb.* TO 'app'@'localhost';",
|
||
"reason": "Review signal: MySQL runtime user has admin privileges. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Separate runtime/migration accounts; remove unnecessary global grants and GRANT OPTION; match account hosts to topology.",
|
||
"check": "SHOW GRANTS contains only required actions; migrations/checker still work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-mysql-privileges",
|
||
"detection": "Regex: GRANT with FILE/SUPER or ALL [PRIVILEGES] ON *.*. Review other dangerous dynamic privileges, roles and existing grants.",
|
||
"pattern": "\\bGRANT\\s+(?:(?:[A-Z_]+\\s*,\\s*)*(?:FILE|SUPER)\\b|ALL(?:\\s+PRIVILEGES)?\\s+ON\\s+\\*\\s*\\.\\s*\\*)",
|
||
"references": [
|
||
"https://dev.mysql.com/doc/refman/8.4/en/privileges-provided.html"
|
||
],
|
||
"limitations": "Regex: GRANT with FILE/SUPER or ALL [PRIVILEGES] ON *.*. Review other dangerous dynamic privileges, roles and existing grants.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "SQL-RLS-DISABLE",
|
||
"title": "PostgreSQL table RLS disabled",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"engine": "regex",
|
||
"before": "ALTER TABLE notes DISABLE ROW LEVEL SECURITY;",
|
||
"after": "ALTER TABLE notes ENABLE ROW LEVEL SECURITY;\nALTER TABLE notes FORCE ROW LEVEL SECURITY;\n-- Install reviewed owner/tenant policies before serving traffic.",
|
||
"reason": "Review signal: PostgreSQL table RLS disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Install intended policies and enable RLS; runtime must not be superuser/BYPASSRLS. FORCE constrains table owners, not these bypass roles.",
|
||
"check": "Test SELECT/INSERT/UPDATE/DELETE with two runtime identities/tenants and separate migration role.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-rls-disable",
|
||
"detection": "Regex: ALTER TABLE ... DISABLE ROW LEVEL SECURITY. Does not infer missing ENABLE, broad policies or connection role.",
|
||
"pattern": "\\bALTER\\s+TABLE\\s+[^;\\n]{1,180}\\s+DISABLE\\s+ROW\\s+LEVEL\\s+SECURITY\\b",
|
||
"references": [
|
||
"https://www.postgresql.org/docs/current/ddl-rowsecurity.html"
|
||
],
|
||
"limitations": "Regex: ALTER TABLE ... DISABLE ROW LEVEL SECURITY. Does not infer missing ENABLE, broad policies or connection role.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "CFG-K8S-HOST",
|
||
"title": "Container shares host namespaces",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "hostPID: true\nhostIPC: true\nhostNetwork: true",
|
||
"after": "hostPID: false\nhostIPC: false\nhostNetwork: false",
|
||
"reason": "Review signal: Container shares host namespaces. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Disable unnecessary host namespaces; implement required connectivity within approved competition topology and verify probes/ports.",
|
||
"check": "Service/checker works without host process/IPC visibility or unintended sockets.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-k8s-host",
|
||
"detection": "Regex: hostPID/hostIPC/hostNetwork:true and Compose pid/ipc/network_mode:host. No admission-policy or running-pod analysis.",
|
||
"pattern": "\\b(?:hostPID|hostIPC|hostNetwork)[\"\\']?\\s*:\\s*true\\b|\\b(?:pid|ipc|network_mode)[\"\\']?\\s*:\\s*[\"\\']?host\\b",
|
||
"references": [
|
||
"https://kubernetes.io/docs/concepts/security/pod-security-standards/"
|
||
],
|
||
"limitations": "Regex: hostPID/hostIPC/hostNetwork:true and Compose pid/ipc/network_mode:host. No admission-policy or running-pod analysis.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-UNCONFINED",
|
||
"title": "seccomp/AppArmor profile disabled",
|
||
"languages": [
|
||
"config",
|
||
"docker",
|
||
"shell"
|
||
],
|
||
"engine": "regex",
|
||
"before": "security_opt:\n - seccomp:unconfined\n - apparmor:unconfined",
|
||
"after": "security_opt:\n - no-new-privileges:true\n# Keep the runtime default seccomp/AppArmor profiles.",
|
||
"reason": "Review signal: seccomp/AppArmor profile disabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Restore the default or minimum compatible profile with narrow exceptions.",
|
||
"check": "Normal operations/checker work and the effective container applies the profile.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-unconfined",
|
||
"detection": "Regex: seccomp/apparmor=unconfined or :unconfined and Kubernetes type:Unconfined. Unrelated YAML type keys may match.",
|
||
"pattern": "\\b(?:seccomp|apparmor)\\s*[:=]\\s*[\"\\']?unconfined\\b|\\btype[\"\\']?\\s*:\\s*[\"\\']?Unconfined\\b",
|
||
"references": [
|
||
"https://docs.docker.com/engine/security/seccomp/"
|
||
],
|
||
"limitations": "Regex: seccomp/apparmor=unconfined or :unconfined and Kubernetes type:Unconfined. Unrelated YAML type keys may match.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-PRIV-ESCALATION",
|
||
"title": "Process privilege escalation allowed",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "allowPrivilegeEscalation: true",
|
||
"after": "allowPrivilegeEscalation: false",
|
||
"reason": "Review signal: Process privilege escalation allowed. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Disable allowPrivilegeEscalation and remove privileged/CAP_SYS_ADMIN and unnecessary capabilities.",
|
||
"check": "Required operations work and effective securityContext matches the manifest.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-priv-escalation",
|
||
"detection": "Regex: explicit allowPrivilegeEscalation:true. Review missing fields, defaults and interactions with privileged/CAP_SYS_ADMIN.",
|
||
"pattern": "\\ballowPrivilegeEscalation[\"\\']?\\s*:\\s*true\\b",
|
||
"references": [
|
||
"https://kubernetes.io/docs/tasks/configure-pod-container/security-context/"
|
||
],
|
||
"limitations": "Regex: explicit allowPrivilegeEscalation:true. Review missing fields, defaults and interactions with privileged/CAP_SYS_ADMIN.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-K8S-RBAC",
|
||
"title": "Workload bound to cluster-admin",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "roleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: cluster-admin",
|
||
"after": "roleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: Role\n name: notes-read-config",
|
||
"reason": "Review signal: Workload bound to cluster-admin. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Use a least-privilege Role and namespaced RoleBinding; review subjects, verbs, resources, names and impersonate/bind/escalate.",
|
||
"check": "Runtime identity can perform only required operations, not read foreign Secrets or grant rights.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-k8s-rbac",
|
||
"detection": "Regex: name:cluster-admin. Does not connect roleRef to subjects or find equivalent wildcard roles; inspect remaining RBAC manually.",
|
||
"pattern": "\\bname[\"\\']?\\s*:\\s*[\"\\']?cluster-admin(?:[\\\"\\']|\\s|$)",
|
||
"references": [
|
||
"https://kubernetes.io/docs/reference/access-authn-authz/rbac/"
|
||
],
|
||
"limitations": "Regex: name:cluster-admin. Does not connect roleRef to subjects or find equivalent wildcard roles; inspect remaining RBAC manually.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-ACTUATOR",
|
||
"title": "Spring Actuator exposes every endpoint",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "management.endpoints.web.exposure.include=*",
|
||
"after": "management.endpoints.web.exposure.include=health",
|
||
"reason": "Review signal: Spring Actuator exposes every endpoint. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Expose only necessary endpoints and restrict management access; inspect health details/custom SecurityFilterChain separately.",
|
||
"check": "Health/checker works; env, heapdump, loggers, shutdown and unnecessary endpoints require approved admin access.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-actuator",
|
||
"detection": "Regex: flat property or MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE with *. Inspect nested YAML and active profiles using endpoints/exposure/include.",
|
||
"pattern": "\\b(?:management\\.endpoints\\.web\\.exposure\\.include|MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE)[\"\\']?\\s*[:=]\\s*[\"\\']?\\*",
|
||
"references": [
|
||
"https://docs.spring.io/spring-boot/reference/actuator/endpoints.html"
|
||
],
|
||
"limitations": "Regex: flat property or MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE with *. Inspect nested YAML and active profiles using endpoints/exposure/include.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-H2-CONSOLE",
|
||
"title": "H2 web console enabled",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "spring.h2.console.enabled=true",
|
||
"after": "spring.h2.console.enabled=false",
|
||
"reason": "Review signal: H2 web console enabled. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Disable in the runtime profile or provide protected local admin access; never remove application-wide auth/CSRF for it.",
|
||
"check": "Database operations work; console is not exposed to the game network.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-h2-console",
|
||
"detection": "Regex: spring.h2.console.enabled/SPRING_H2_CONSOLE_ENABLED=true. Inspect nested YAML, aliases and active profiles.",
|
||
"pattern": "\\b(?:spring\\.h2\\.console\\.enabled|SPRING_H2_CONSOLE_ENABLED)[\"\\']?\\s*[:=]\\s*[\"\\']?true\\b",
|
||
"references": [
|
||
"https://docs.spring.io/spring-boot/reference/data/sql.html#data.sql.h2-web-console"
|
||
],
|
||
"limitations": "Regex: spring.h2.console.enabled/SPRING_H2_CONSOLE_ENABLED=true. Inspect nested YAML, aliases and active profiles.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-TLS-UPSTREAM",
|
||
"title": "Proxy does not verify upstream TLS",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "proxy_ssl_verify off;",
|
||
"after": "proxy_ssl_verify on;\nproxy_ssl_trusted_certificate /etc/nginx/trusted-ca.pem;\nproxy_ssl_server_name on;\nproxy_ssl_name notes.internal;",
|
||
"reason": "Review signal: Proxy does not verify upstream TLS. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Enable verification, trusted CA and correct name/SNI; validate chain/intermediate depth for the actual upstream.",
|
||
"check": "Correct backend works; wrong certificate/host fails without HTTP fallback.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-tls-upstream",
|
||
"detection": "Regex: proxy_ssl_verify/grpc_ssl_verify off. Missing directives, inheritance and effective values require complete nginx config review.",
|
||
"pattern": "\\b(?:proxy_ssl_verify|grpc_ssl_verify)\\s+off\\s*;",
|
||
"references": [
|
||
"https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_verify"
|
||
],
|
||
"limitations": "Regex: proxy_ssl_verify/grpc_ssl_verify off. Missing directives, inheritance and effective values require complete nginx config review.",
|
||
"family": "network-exposure",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-SSH-EMPTY-PASSWORD",
|
||
"title": "SSHD permits empty passwords",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "PermitEmptyPasswords yes",
|
||
"after": "PermitEmptyPasswords no",
|
||
"reason": "Review signal: SSHD permits empty passwords. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Disallow empty passwords; review Match/PAM/accounts while retaining a working administration channel before applying changes.",
|
||
"check": "Approved login works; empty passwords fail in every applicable Match context.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-ssh-empty-password",
|
||
"detection": "Regex: PermitEmptyPasswords yes. Recognizes sshd_config; include files with arbitrary names require explicit review.",
|
||
"pattern": "^\\s*PermitEmptyPasswords\\s+yes\\b",
|
||
"references": [
|
||
"https://man.openbsd.org/sshd_config#PermitEmptyPasswords"
|
||
],
|
||
"limitations": "Regex: PermitEmptyPasswords yes. Recognizes sshd_config; include files with arbitrary names require explicit review.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "CFG-SUDO-ALL",
|
||
"title": "Unrestricted passwordless sudo",
|
||
"languages": [
|
||
"config"
|
||
],
|
||
"engine": "regex",
|
||
"before": "app ALL=(ALL:ALL) NOPASSWD: ALL",
|
||
"after": "# Runtime user has no sudo grant.\n# Provision required resources before service startup.",
|
||
"reason": "Review signal: Unrestricted passwordless sudo. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Remove runtime sudo; move rare privileged operations into a minimal helper without arbitrary argv, shell or writable dependencies.",
|
||
"check": "Service works without sudo; effective rights contain neither ALL nor shell-escaping commands.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-sudo-all",
|
||
"detection": "Regex: NOPASSWD:ALL. Review aliases, includes, wildcard argv and dangerous allowed binaries; recognizes sudoers.",
|
||
"pattern": "\\bNOPASSWD\\s*:\\s*ALL\\b",
|
||
"references": [
|
||
"https://www.sudo.ws/docs/man/sudoers.man/"
|
||
],
|
||
"limitations": "Regex: NOPASSWD:ALL. Review aliases, includes, wildcard argv and dangerous allowed binaries; recognizes sudoers.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review"
|
||
},
|
||
{
|
||
"id": "SQL-TOKEN-PREFIX",
|
||
"title": "Secret token checked by prefix or range",
|
||
"languages": [
|
||
"sql",
|
||
"python",
|
||
"javascript",
|
||
"php",
|
||
"go",
|
||
"java",
|
||
"csharp",
|
||
"ruby",
|
||
"rust"
|
||
],
|
||
"engine": "regex",
|
||
"before": "SELECT content FROM exports WHERE username = $1 AND nonce >= $2 AND nonce < $3;",
|
||
"after": "SELECT content FROM exports WHERE username = $1 AND nonce = $2;\n-- Before querying: require the full canonical token, correct length/type and purpose.",
|
||
"reason": "Review signal: Secret token checked by prefix or range. Trace data origin, validation and actual use; a match does not prove a vulnerability.",
|
||
"fix": "Require the complete canonical token with valid length/type, exact equality and binding to user/purpose/expiry; rate limiting is separate.",
|
||
"check": "Empty, short, prefix, extra-suffix and foreign-user tokens fail; complete valid tokens work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-token-prefix",
|
||
"detection": "Regex: nonce/token/reset_token/api_key before LIKE, >= or <= in SQL text. Counters/log searches may be legitimate; inspect renamed fields, substr, startsWith and application-side partial comparisons.",
|
||
"pattern": "\\b(?:nonce|token|reset_token|api_key)\\s*(?:LIKE\\b|>=|<=)",
|
||
"references": [
|
||
"https://github.com/enowars/enowars10-service-flagdrive/blob/d1575098fe2c516460136bb5fba11d9a1c4af3f7/documentation/FLAGSTORE_0.md"
|
||
],
|
||
"limitations": "Regex: nonce/token/reset_token/api_key before LIKE, >= or <= in SQL text. Counters/log searches may be legitimate; inspect renamed fields, substr, startsWith and application-side partial comparisons.",
|
||
"family": "authentication",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review"
|
||
},
|
||
{
|
||
"id": "PY-AUTH-DECORATOR",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Flask route registers before login protection",
|
||
"engine": "python-ast",
|
||
"before": "from flask import Flask\nfrom flask_login import login_required\napp = Flask(__name__)\n@login_required\n@app.route('/private')\ndef private():\n return 'private'",
|
||
"after": "from flask import Flask\nfrom flask_login import login_required\napp = Flask(__name__)\n@app.route('/private')\n@login_required\ndef private():\n return 'private'",
|
||
"fix": "Put the known Flask route decorator outside login_required; verify authorization using the registered endpoint, not only direct function calls.",
|
||
"check": "Anonymous requests must fail through the real route; authenticated requests and checker behavior must still work.",
|
||
"doc": "docs/vulnerabilities/python.md#py-auth-decorator",
|
||
"reason": "Review signal: Flask route registers before login protection. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "AST: imported flask_login.login_required above route/get/post/put/patch/delete on a known Flask/Blueprint constructor. Aliases and straight-line rebinding respected. Custom decorators, factories, dynamic routes and other registration methods remain manual.",
|
||
"limitations": "AST: imported flask_login.login_required above route/get/post/put/patch/delete on a known Flask/Blueprint constructor. Aliases and straight-line rebinding respected. Custom decorators, factories, dynamic routes and other registration methods remain manual.",
|
||
"family": "authentication",
|
||
"cwe": [
|
||
"CWE-862"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://flask.palletsprojects.com/en/stable/patterns/viewdecorators/"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"coverage_required": [
|
||
"python"
|
||
]
|
||
},
|
||
{
|
||
"id": "PY-LOG-CREDENTIALS",
|
||
"languages": [
|
||
"python"
|
||
],
|
||
"title": "Credential-like value passed directly to logging",
|
||
"engine": "python-ast",
|
||
"before": "import logging\nlogging.warning('authentication failed: %s', password)",
|
||
"after": "import logging\nlogging.warning('authentication failed')",
|
||
"fix": "Log stable event categories and approved identifiers, never credential values or Authorization headers; test failed login and exception paths.",
|
||
"check": "Canary credentials must not appear in stdout, logs, evidence or broadcasts; useful failure diagnostics remain available.",
|
||
"doc": "docs/vulnerabilities/python.md#py-log-credentials",
|
||
"reason": "Review signal: Credential-like value passed directly to logging. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "AST: known logging module/getLogger or Flask app.logger methods with direct sensitive names/attributes/subscripts, dict/list values or simple format expressions. Names: password/passwd/secret/token/access_token/refresh_token/api_key/authorization. Helper calls, logging kwargs, wrappers and other names are not traced; no helper-call signal does not verify redaction.",
|
||
"limitations": "AST: known logging module/getLogger or Flask app.logger methods with direct sensitive names/attributes/subscripts, dict/list values or simple format expressions. Names: password/passwd/secret/token/access_token/refresh_token/api_key/authorization. Helper calls, logging kwargs, wrappers and other names are not traced; no helper-call signal does not verify redaction.",
|
||
"family": "secret-handling",
|
||
"cwe": [
|
||
"CWE-532"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://docs.python.org/3/library/logging.html",
|
||
"https://flask.palletsprojects.com/en/stable/logging/"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"coverage_required": [
|
||
"python"
|
||
]
|
||
},
|
||
{
|
||
"id": "JS-REDIRECT-INPUT",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Request field passed directly to an Express-style redirect",
|
||
"engine": "regex",
|
||
"before": "res.redirect(req.query.next);",
|
||
"after": "res.redirect('/account');",
|
||
"fix": "Resolve redirects using a server-owned route table or an explicit normalized URL policy.",
|
||
"check": "External and scheme-relative destinations fail; approved navigation still works.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-redirect-input",
|
||
"reason": "Review signal: Request field passed directly to an Express-style redirect. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical comment/string exclusions: res/response.redirect with direct req/request.query/body/params property, optionally following a literal status code. Not receiver typing or data-flow analysis; computed keys, aliases and upstream validation need review.",
|
||
"limitations": "Regex with lexical comment/string exclusions: res/response.redirect with direct req/request.query/body/params property, optionally following a literal status code. Not receiver typing or data-flow analysis; computed keys, aliases and upstream validation need review.",
|
||
"family": "network-exposure",
|
||
"cwe": [
|
||
"CWE-601"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://expressjs.com/en/4x/api.html#res.redirect"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\b(?:res|response)\\s*\\.\\s*redirect\\s*\\(\\s*(?:[12345][0-9]{2}\\s*,\\s*)?(?:req|request)\\s*\\.\\s*(?:query|body|params)\\s*\\.\\s*[A-Za-z_]\\w*",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "PHP-LDAP-FILTER",
|
||
"languages": [
|
||
"php"
|
||
],
|
||
"title": "LDAP filter concatenates a PHP variable",
|
||
"engine": "regex",
|
||
"before": "ldap_search($conn, $base, '(uid=' . $name . ')');",
|
||
"after": "$filter = '(uid=' . ldap_escape($name, '', LDAP_ESCAPE_FILTER) . ')';\nldap_search($conn, $base, $filter);",
|
||
"fix": "Escape values for LDAP filter context, not DN context; keep attribute names and search scope trusted.",
|
||
"check": "LDAP metacharacters in a value do not widen results; authorized lookups work.",
|
||
"doc": "docs/vulnerabilities/php.md#php-ldap-filter",
|
||
"reason": "Review signal: LDAP filter concatenates a PHP variable. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: ldap_search/list/read with simple first two arguments and a string concatenated directly with a variable as the third argument. Variables may already be escaped; prebuilt filters and interpolation need manual review.",
|
||
"limitations": "Regex with lexical exclusions: ldap_search/list/read with simple first two arguments and a string concatenated directly with a variable as the third argument. Variables may already be escaped; prebuilt filters and interpolation need manual review.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-90"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://www.php.net/manual/en/function.ldap-escape.php"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\bldap_(?:search|list|read)\\s*\\(\\s*[^,;\\n]{1,100},\\s*[^,;\\n]{1,100},\\s*['\"][^'\"\\n]{0,160}['\"]\\s*\\.\\s*\\$[A-Za-z_]\\w*",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "GO-UPLOAD-PATH",
|
||
"languages": [
|
||
"go"
|
||
],
|
||
"title": "Multipart filename used directly in a joined path",
|
||
"engine": "regex",
|
||
"before": "path := filepath.Join(root, header.Filename)",
|
||
"after": "path := filepath.Join(root, serverGeneratedID)",
|
||
"fix": "Choose a non-overwriting server-side storage name outside executable/public roots; authorize downloads and enforce upload size/type.",
|
||
"check": "Alternate separators, traversal, collisions and other-owner requests cannot change the chosen storage path; ordinary uploads work.",
|
||
"doc": "docs/vulnerabilities/go.md#go-upload-path",
|
||
"reason": "Review signal: Multipart filename used directly in a joined path. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: filepath.Join with a simple first argument and a direct header/fileHeader/file.Filename second argument. The MIME parser may normalize filenames; the rule does not prove traversal, imported types or missing earlier validation.",
|
||
"limitations": "Regex with lexical exclusions: filepath.Join with a simple first argument and a direct header/fileHeader/file.Filename second argument. The MIME parser may normalize filenames; the rule does not prove traversal, imported types or missing earlier validation.",
|
||
"family": "file-access",
|
||
"cwe": [
|
||
"CWE-22"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://pkg.go.dev/mime/multipart#FileHeader"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\bfilepath\\s*\\.\\s*Join\\s*\\(\\s*[^,;\\n]{1,100},\\s*(?:header|fileHeader|file)\\s*\\.\\s*Filename\\s*\\)",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "JAVA-LDAP-FILTER",
|
||
"languages": [
|
||
"java"
|
||
],
|
||
"title": "JNDI search filter assembled by concatenation",
|
||
"engine": "regex",
|
||
"before": "ctx.search(base, \"(uid=\" + name + \")\", controls);",
|
||
"after": "ctx.search(base, \"(uid={0})\", new Object[] { name }, controls);",
|
||
"fix": "Use JNDI filter arguments with a fixed filter, and retain explicit search scope and authorization.",
|
||
"check": "Filter metacharacters remain values; unauthorized entries stay inaccessible and valid searches work.",
|
||
"doc": "docs/vulnerabilities/java.md#java-ldap-filter",
|
||
"reason": "Review signal: JNDI search filter assembled by concatenation. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: ctx/context/dirContext.search with a simple first argument and directly concatenated string filter. Does not resolve receiver types, prebuilt filters, wrappers or earlier escaping.",
|
||
"limitations": "Regex with lexical exclusions: ctx/context/dirContext.search with a simple first argument and directly concatenated string filter. Does not resolve receiver types, prebuilt filters, wrappers or earlier escaping.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-90"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://docs.oracle.com/javase/jndi/tutorial/ldap/search/search.html"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\b(?:ctx|context|dirContext)\\s*\\.\\s*search\\s*\\(\\s*[^,;\\n]{1,100},\\s*\"[^\"\\n]{0,160}\"\\s*\\+\\s*[A-Za-z_]\\w*",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "CS-LDAP-FILTER",
|
||
"languages": [
|
||
"csharp"
|
||
],
|
||
"title": "DirectorySearcher filter concatenates a value",
|
||
"engine": "regex",
|
||
"before": "var query = new DirectorySearcher(\"(uid=\" + name + \")\");",
|
||
"after": "var query = new DirectorySearcher(BuildReviewedLdapFilter(name)); // helper implements filter-context escaping",
|
||
"fix": "Use a reviewed LDAP filter builder with filter-context escaping and fixed attribute/scope policy; the helper is application-specific.",
|
||
"check": "Metacharacters cannot add conditions or broaden results; supported lookups remain compatible.",
|
||
"doc": "docs/vulnerabilities/csharp.md#cs-ldap-filter",
|
||
"reason": "Review signal: DirectorySearcher filter concatenates a value. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: new DirectorySearcher with a first string literal concatenated with an identifier. Does not inspect Filter assignments, interpolated strings, helper implementations or arbitrary type aliases.",
|
||
"limitations": "Regex with lexical exclusions: new DirectorySearcher with a first string literal concatenated with an identifier. Does not inspect Filter assignments, interpolated strings, helper implementations or arbitrary type aliases.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-90"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://learn.microsoft.com/en-us/dotnet/api/system.directoryservices.directorysearcher.filter"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\bnew\\s+(?:System\\.DirectoryServices\\.)?DirectorySearcher\\s*\\(\\s*\"[^\"\\n]{0,160}\"\\s*\\+\\s*[A-Za-z_]\\w*",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "RUBY-REDIRECT-INPUT",
|
||
"languages": [
|
||
"ruby"
|
||
],
|
||
"title": "Rails redirect takes request params directly",
|
||
"engine": "regex",
|
||
"before": "redirect_to params[:next]",
|
||
"after": "redirect_to account_path",
|
||
"fix": "Use server-selected routes or an explicit redirect policy; preserve Rails' host checks and review the installed framework version.",
|
||
"check": "Foreign and scheme-relative destinations fail; legitimate navigation works.",
|
||
"doc": "docs/vulnerabilities/ruby.md#ruby-redirect-input",
|
||
"reason": "Review signal: Rails redirect takes request params directly. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: redirect_to with params[...] or request.params[...], with optional opening parenthesis. Framework defaults may already reject external hosts; aliases, helpers and allow_other_host configuration need review.",
|
||
"limitations": "Regex with lexical exclusions: redirect_to with params[...] or request.params[...], with optional opening parenthesis. Framework defaults may already reject external hosts; aliases, helpers and allow_other_host configuration need review.",
|
||
"family": "network-exposure",
|
||
"cwe": [
|
||
"CWE-601"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://api.rubyonrails.org/classes/ActionController/Redirecting.html"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\bredirect_to\\s*(?:\\(\\s*)?(?:request\\s*\\.\\s*)?params\\s*\\[",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "RUST-UNBOUNDED-READ",
|
||
"languages": [
|
||
"rust"
|
||
],
|
||
"title": "Potentially unbounded Rust stream read",
|
||
"engine": "regex",
|
||
"before": "stream.read_to_end(&mut payload)?;",
|
||
"after": "let mut bounded = stream.take(MAX_BYTES + 1);\nbounded.read_to_end(&mut payload)?;\nif payload.len() as u64 > MAX_BYTES { return Err(too_large()); }",
|
||
"fix": "Bound reads, detect limit+1 and enforce an appropriate timeout; Read::take alone silently stops at its limit.",
|
||
"check": "Test EOF, limit-1, limit, limit+1 and a slow never-ending source; valid maximum documents work.",
|
||
"doc": "docs/vulnerabilities/rust.md#rust-unbounded-read",
|
||
"reason": "Review signal: Potentially unbounded Rust stream read. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: stream/socket/request/reader.read_to_end/read_to_string. Receiver names are hints, not types; an already bounded receiver may match and other names/wrappers may be missed.",
|
||
"limitations": "Regex with lexical exclusions: stream/socket/request/reader.read_to_end/read_to_string. Receiver names are hints, not types; an already bounded receiver may match and other names/wrappers may be missed.",
|
||
"family": "resource-limits",
|
||
"cwe": [
|
||
"CWE-400"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://doc.rust-lang.org/std/io/trait.Read.html#method.take"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\b(?:stream|socket|request|reader)\\s*\\.\\s*read_to_(?:end|string)\\s*\\(",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "C-COPY-LENGTH",
|
||
"languages": [
|
||
"native"
|
||
],
|
||
"title": "Copy length comes directly from source strlen",
|
||
"engine": "regex",
|
||
"before": "memcpy(dest, input, strlen(input) + 1);",
|
||
"after": "size_t n = validated_length;\nif (n >= capacity) return ERROR;\nmemcpy(dest, input, n + 1);",
|
||
"fix": "Validate readable source length and destination capacity before copying, including terminator and arithmetic overflow.",
|
||
"check": "Test empty input, capacity boundaries, missing terminator and overflow using sanitizers where available.",
|
||
"doc": "docs/vulnerabilities/c-cpp.md#c-copy-length",
|
||
"reason": "Review signal: Copy length comes directly from source strlen. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: memcpy/memmove with simple first two arguments and strlen/strnlen directly as length. Does not prove missing preceding checks or actual buffer sizes; custom same-named APIs and macros require review.",
|
||
"limitations": "Regex with lexical exclusions: memcpy/memmove with simple first two arguments and strlen/strnlen directly as length. Does not prove missing preceding checks or actual buffer sizes; custom same-named APIs and macros require review.",
|
||
"family": "memory-safety",
|
||
"cwe": [
|
||
"CWE-787"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://pubs.opengroup.org/onlinepubs/9799919799/functions/memcpy.html"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\b(?:memcpy|memmove)\\s*\\(\\s*[^,;\\n]{1,100},\\s*[^,;\\n]{1,100},\\s*(?:strlen|strnlen)\\s*\\(",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "CFG-COOKIE-FLAGS",
|
||
"languages": [
|
||
"config",
|
||
"python",
|
||
"javascript"
|
||
],
|
||
"title": "Explicitly weakened session cookie flags",
|
||
"engine": "regex",
|
||
"before": "SESSION_COOKIE_HTTPONLY = False",
|
||
"after": "SESSION_COOKIE_HTTPONLY = True",
|
||
"fix": "Keep session cookies HttpOnly and use Secure where the approved service transport supports HTTPS; changing Secure on an HTTP-only checker requires a coordinated transport decision.",
|
||
"check": "Scripts cannot read session cookies; sessions work over the intended transport and secure cookies are not sent over plaintext.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-cookie-flags",
|
||
"reason": "Review signal: explicitly weakened session cookie flags. Check the real framework and transport contract before patching.",
|
||
"detection": "Regex with lexical exclusions: bare Django SESSION_COOKIE_HTTPONLY/SESSION_COOKIE_SECURE/CSRF_COOKIE_SECURE=false/0. Python AST: known Flask config subscript/update/from_mapping with disabled session HttpOnly/Secure. JS bounded tokens: default imported express-session with inline cookie.httpOnly:false. Dynamic configs/defaults remain manual. JS secure:false alone is not a new signal; HTTPS/checker compatibility must be reviewed.",
|
||
"limitations": "Regex with lexical exclusions: bare Django SESSION_COOKIE_HTTPONLY/SESSION_COOKIE_SECURE/CSRF_COOKIE_SECURE=false/0. Python AST: known Flask config subscript/update/from_mapping with disabled session HttpOnly/Secure. JS bounded tokens: default imported express-session with inline cookie.httpOnly:false. Dynamic configs/defaults remain manual. JS secure:false alone is not a new signal; HTTPS/checker compatibility must be reviewed.",
|
||
"family": "authentication",
|
||
"cwe": [
|
||
"CWE-614",
|
||
"CWE-1004"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review",
|
||
"references": [
|
||
"https://docs.djangoproject.com/en/5.2/ref/settings/#session-cookie-httponly",
|
||
"https://flask.palletsprojects.com/en/stable/config/",
|
||
"https://expressjs.com/en/resources/middleware/session/"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\b(?:SESSION_COOKIE_HTTPONLY|SESSION_COOKIE_SECURE|CSRF_COOKIE_SECURE)\\s*[:=]\\s*(?:false|0)\\b",
|
||
"code_only": true,
|
||
"coverage_required": [
|
||
"python",
|
||
"javascript"
|
||
]
|
||
},
|
||
{
|
||
"id": "CFG-DOCKER-TCP",
|
||
"languages": [
|
||
"shell",
|
||
"docker"
|
||
],
|
||
"title": "Docker daemon listens on every TCP interface",
|
||
"engine": "regex",
|
||
"before": "dockerd -H tcp://0.0.0.0:2375",
|
||
"after": "dockerd -H unix:///var/run/docker.sock",
|
||
"fix": "Prefer local Docker access. Required remote management needs authenticated encrypted transport and a deliberately restricted management interface; never publish it as a team UI.",
|
||
"check": "Unapproved LAN clients cannot control Docker; approved administration remains possible without exposing credentials.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-docker-tcp",
|
||
"reason": "Review signal: Docker daemon listens on every TCP interface. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: dockerd followed on the same line by -H/--host tcp://0.0.0.0 or [::]. Does not evaluate TLS flags, JSON daemon configuration, named interfaces or shell expansions; a TLS-protected listener still requires review.",
|
||
"limitations": "Regex with lexical exclusions: dockerd followed on the same line by -H/--host tcp://0.0.0.0 or [::]. Does not evaluate TLS flags, JSON daemon configuration, named interfaces or shell expansions; a TLS-protected listener still requires review.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review",
|
||
"references": [
|
||
"https://docs.docker.com/reference/cli/dockerd/#daemon-socket-option"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\bdockerd\\b[^\\n;]{0,200}?(?:-H[ =]*|--host[ =]+)tcp://(?:0\\.0\\.0\\.0|\\[::\\]):[0-9]{1,5}\\b",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "CFG-FLOATING-IMAGE",
|
||
"languages": [
|
||
"docker",
|
||
"config"
|
||
],
|
||
"title": "Explicit latest image tag",
|
||
"engine": "regex",
|
||
"before": "FROM example.invalid/app:latest",
|
||
"after": "FROM example.invalid/app@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||
"fix": "Record the approved source version and architecture-specific image digest; populate the offline image inventory and verify imported images.",
|
||
"check": "Repeated offline starts use the approved bytes and architecture; no implicit pull or latest fallback occurs.",
|
||
"doc": "docs/vulnerabilities/configuration.md#cfg-floating-image",
|
||
"reason": "Review signal: Explicit latest image tag. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: Docker FROM or a bare YAML image key using an unquoted image:latest with no digest. Quoted YAML, untagged images, other mutable tags, ARG expansion and resolved architecture need deployment-model audit.",
|
||
"limitations": "Regex with lexical exclusions: Docker FROM or a bare YAML image key using an unquoted image:latest with no digest. Quoted YAML, untagged images, other mutable tags, ARG expansion and resolved architecture need deployment-model audit.",
|
||
"family": "container-isolation",
|
||
"cwe": [],
|
||
"review_priority": "normal",
|
||
"signal_kind": "configuration-review",
|
||
"references": [
|
||
"https://docs.docker.com/reference/dockerfile/#from"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "^[ \\t]*(?:FROM[ \\t]+(?:--platform=\\S+[ \\t]+)?|image[ \\t]*:[ \\t]*)[A-Za-z0-9][A-Za-z0-9./_:-]{0,200}:latest(?=\\s|$)",
|
||
"language_patterns": {
|
||
"docker": "^[ \\t]*FROM[ \\t]+(?:--platform=\\S+[ \\t]+)?[A-Za-z0-9][A-Za-z0-9./_:-]{0,200}:latest(?=\\s|$)",
|
||
"config": "^[ \\t]*image[ \\t]*:[ \\t]*[A-Za-z0-9][A-Za-z0-9./_:-]{0,200}:latest(?=\\s|$)"
|
||
},
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "SQL-RLS-ALLOW-ALL",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"title": "RLS policy has an unconditional expression",
|
||
"engine": "regex",
|
||
"before": "CREATE POLICY open_notes ON notes USING (true);",
|
||
"after": "CREATE POLICY owned_notes ON notes USING (owner_id = current_user);",
|
||
"fix": "Define role/tenant-aware USING and WITH CHECK expressions for the actual identity model; review permissive-policy combinations and bypass roles.",
|
||
"check": "Two runtime identities cannot read/change each other's rows; inserts and updates enforce the intended owner and valid operations work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-rls-allow-all",
|
||
"reason": "Review signal: RLS policy has an unconditional expression. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex with lexical exclusions: USING(true) or WITH CHECK(true). May be intentional and does not associate expressions with CREATE POLICY, roles or commands; effective policies and application authorization require review.",
|
||
"limitations": "Regex with lexical exclusions: USING(true) or WITH CHECK(true). May be intentional and does not associate expressions with CREATE POLICY, roles or commands; effective policies and application authorization require review.",
|
||
"family": "authentication",
|
||
"cwe": [
|
||
"CWE-863"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://www.postgresql.org/docs/current/sql-createpolicy.html"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\b(?:USING|WITH\\s+CHECK)\\s*\\(\\s*true\\s*\\)",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "TPL-AUTOESCAPE-OFF",
|
||
"languages": [
|
||
"template"
|
||
],
|
||
"title": "Template block disables autoescaping",
|
||
"engine": "regex",
|
||
"before": "{% autoescape false %}{{ message }}{% endautoescape %}",
|
||
"after": "{{ message }}",
|
||
"fix": "Retain autoescaping for untrusted text; sanitize supported HTML explicitly and review the output context.",
|
||
"check": "User tags/attributes remain data and allowed formatting still works.",
|
||
"doc": "docs/vulnerabilities/configuration.md#tpl-autoescape-off",
|
||
"reason": "Review signal: Template block disables autoescaping. A match is not proof of exploitability; validate the actual service contract.",
|
||
"detection": "Regex excluding HTML/Jinja comments: Jinja/Twig autoescape false and Django autoescape off blocks. Does not evaluate template engine defaults, enclosing blocks or whether values are trusted.",
|
||
"limitations": "Regex excluding HTML/Jinja comments: Jinja/Twig autoescape false and Django autoescape off blocks. Does not evaluate template engine defaults, enclosing blocks or whether values are trusted.",
|
||
"family": "injection",
|
||
"cwe": [
|
||
"CWE-79"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://jinja.palletsprojects.com/en/stable/templates/#autoescape-overrides"
|
||
],
|
||
"introduced": "1.7.0",
|
||
"pattern": "\\{%\\s*autoescape\\s+(?:false|off)\\s*%\\}",
|
||
"code_only": true
|
||
},
|
||
{
|
||
"id": "JS-LOG-CREDENTIALS",
|
||
"languages": [
|
||
"javascript"
|
||
],
|
||
"title": "Credential-like value passed directly to console",
|
||
"engine": "javascript-tokens",
|
||
"before": "console.warn(req.headers.authorization);",
|
||
"after": "console.warn('authentication failed');",
|
||
"fix": "Log stable event categories and approved identifiers, not credential values. Inspect failed-login and exception paths; implement and test any redaction helper independently.",
|
||
"check": "Synthetic canary credentials never appear in stdout, logs, exported evidence or screen broadcasts; failure categories remain useful.",
|
||
"doc": "docs/vulnerabilities/javascript.md#js-log-credentials",
|
||
"reason": "Review signal: a credential-like value is logged directly. This does not prove that the value is a real secret.",
|
||
"detection": "Bounded JS tokens: console log/info/warn/error/debug/trace with direct sensitive names/properties, inline object/array values or concatenation. Observed console shadows/reassignments suppress hints file-wide. Templates, helper calls, custom loggers, dynamic keys and cross-file flows remain manual; absence of a signal does not verify redaction.",
|
||
"family": "secret-handling",
|
||
"cwe": [
|
||
"CWE-532"
|
||
],
|
||
"review_priority": "normal",
|
||
"signal_kind": "syntactic-review",
|
||
"references": [
|
||
"https://nodejs.org/api/console.html"
|
||
],
|
||
"introduced": "1.8.0",
|
||
"limitations": "Bounded JS tokens: console log/info/warn/error/debug/trace with direct sensitive names/properties, inline object/array values or concatenation. Observed console shadows/reassignments suppress hints file-wide. Templates, helper calls, custom loggers, dynamic keys and cross-file flows remain manual; absence of a signal does not verify redaction."
|
||
},
|
||
{
|
||
"id": "SQL-SERVER-ROLE",
|
||
"languages": [
|
||
"sql"
|
||
],
|
||
"title": "PostgreSQL server file/program role granted",
|
||
"engine": "regex",
|
||
"before": "GRANT pg_read_server_files TO app;",
|
||
"after": "GRANT SELECT ON notes TO app;",
|
||
"fix": "Separate application and administrator roles. Grant only required object privileges, not server file/program access; review memberships and revoke only approved service-owned grants with rollback.",
|
||
"check": "The actual runtime role cannot read/write server files or execute server programs; ordinary queries, migrations and recovery still work.",
|
||
"doc": "docs/vulnerabilities/sql.md#sql-server-role",
|
||
"reason": "Review signal: an elevated PostgreSQL server role is granted. Review the recipient and its actual runtime privileges.",
|
||
"detection": "Bounded SQL: unquoted GRANT role lists containing pg_read_server_files, pg_write_server_files or pg_execute_server_program before TO. Comments/strings excluded; REVOKE and pg_monitor alone do not signal. Quoted roles, inheritance, later revocations, versions and effective permissions remain manual.",
|
||
"family": "authentication",
|
||
"cwe": [
|
||
"CWE-250"
|
||
],
|
||
"review_priority": "high",
|
||
"signal_kind": "configuration-review",
|
||
"references": [
|
||
"https://www.postgresql.org/docs/14/predefined-roles.html"
|
||
],
|
||
"introduced": "1.8.0",
|
||
"pattern": "\\bGRANT\\s+(?:[a-z_][\\w$]*\\s*,\\s*){0,20}(?:pg_read_server_files|pg_write_server_files|pg_execute_server_program)\\b(?:\\s*,\\s*[a-z_][\\w$]*){0,20}\\s+TO\\s+",
|
||
"code_only": true,
|
||
"limitations": "Bounded SQL: unquoted GRANT role lists containing pg_read_server_files, pg_write_server_files or pg_execute_server_program before TO. Comments/strings excluded; REVOKE and pg_monitor alone do not signal. Quoted roles, inheritance, later revocations, versions and effective permissions remain manual."
|
||
}
|
||
]
|
||
}
|