# vulnfix-gaps-v1

> vulnfix-gaps-v1: 33 Keryn rules for python, javascript, typescript, java, csharp, go, php (19 error, 14 warning).

Source: https://keryn.dev/rules/vulnfix-gaps-v1/

33 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do not.

- **Confidence**: **P0** exploitable as written; **P1** dangerous in context; **P2** a heuristic or a posture check: confirm by reading the code.

- **False-positive risk**: **low**: an exact API or flag, so hits are almost always real; **medium**: the pattern is legitimate in many programs, so check each hit; **high**: it finds a lead to confirm, so expect benign hits.

- **Edge**: The relationship the finding sits on. **reaches**: content or traffic gets to a thing; **calls**: one thing invokes another; **reads**: one thing reads from another; **writes**: one thing writes to another; **sends**: data leaves for another party; **grants**: authority is given or left unchecked; **depends_on**: something relies on a component it does not verify; **trusts**: one party believes another without evidence. The boundary it crosses, when there is one: **user->prompt** (untrusted input reaching a prompt); **model->code** (model output reaching code, a shell, a query or a page); **secret->outside** (a secret leaving the trusted side); **supply-chain** (code, models or prompts pulled in from outside).

- **Taxonomy chips**: References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

## keryn.vfgap.pickle-unpickler-py

`warning` python pickle

pickle.Unpickler(file) builds an unpickler whose load() runs any code the stream encodes. Only unpickle data this process produced and signed; use JSON or safetensors for anything that crosses a trust boundary.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain)

**Fix:** Replace pickle with a data format that cannot carry code, or restrict find\_class in an Unpickler subclass to an explicit allow-list.

**References:** [https://docs.python.org/3/library/pickle.html#pickle.Unpickler](https://docs.python.org/3/library/pickle.html#pickle.Unpickler)

## keryn.vfgap.jsonpickle-decode-py

`error` python jsonpickle

jsonpickle.decode rebuilds arbitrary Python objects from JSON, calling constructors and reduce hooks named in the document, so untrusted input runs code. Parse plain JSON and build objects yourself.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain)

**Fix:** Use json.loads and construct the objects explicitly, or pass safe=True and an allow-list of classes.

**References:** [https://jsonpickle.github.io/api.html](https://jsonpickle.github.io/api.html)

## keryn.vfgap.os-popen-non-literal-py

`warning` python python

os.popen runs its argument through the shell. When the command text is built at run time, shell metacharacters in any part of it execute. Use subprocess.run with an argument list and shell=False.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Switch to subprocess.run([...], shell=False) with each argument as its own list element.

**References:** [https://docs.python.org/3/library/os.html#os.popen](https://docs.python.org/3/library/os.html#os.popen)

## keryn.vfgap.subprocess-check-shell-true-py

`warning` python python

subprocess.check\_output / check\_call with shell=True hands the command string to the shell, so any untrusted part of it executes. Pass an argument list and leave shell off. This is a presence check: an allow-list or membership test is seen only in the form `if x not in ALLOWED: return` right before the call, so it is advisory (P2); the taint rules report the untrusted flows.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Use subprocess.check\_output([...]) with a list and no shell=True; allow-list the program name.

**References:** [https://docs.python.org/3/library/subprocess.html#security-considerations](https://docs.python.org/3/library/subprocess.html#security-considerations)

## keryn.vfgap.tls-verification-disabled-py

`error` python requests, httpx

TLS certificate verification is switched off (verify=False), so this client accepts any certificate and a network attacker can read or alter the traffic, including API keys and model responses. Trust a CA bundle instead.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-295](https://keryn.dev/rules/?cwe=CWE-295) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)

**Fix:** Remove verify=False; if you use a private CA, point verify at its bundle path.

**References:** [https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification](https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification)

## keryn.vfgap.ssl-unverified-context-py

`error` python ssl

ssl.\_create\_unverified\_context() returns a context that skips certificate and host-name checks, and assigning it as the default context disables verification process-wide. Use ssl.create\_default\_context().

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-295](https://keryn.dev/rules/?cwe=CWE-295) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)

**Fix:** Replace with ssl.create\_default\_context() and, for a private CA, load its certificate with cafile=.

**References:** [https://docs.python.org/3/library/ssl.html#ssl.create_default_context](https://docs.python.org/3/library/ssl.html#ssl.create_default_context)

## keryn.vfgap.flask-debug-run-py

`error` python flask

app.run(debug=True) starts the Werkzeug debugger, which serves an interactive console that executes Python for anyone who can reach the port. Never ship it; use an environment-driven setting that is off in production.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-489](https://keryn.dev/rules/?cwe=CWE-489) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)

**Fix:** Remove debug=True from run() and use FLASK\_DEBUG only in local development.

**References:** [https://flask.palletsprojects.com/en/stable/debugging/](https://flask.palletsprojects.com/en/stable/debugging/)

## keryn.vfgap.tarfile-extractall-unfiltered-py

`warning` python tarfile

extractall on a tar archive without a filter writes members to the paths the archive names, including ../ and absolute paths and links that point outside the target. A model or dataset archive from outside can overwrite files. Pass filter='data' (Python 3.12+) or check each member.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reads](https://keryn.dev/docs/edges/edge-kinds/#reads) one thing reads from another.

[CWE-22](https://keryn.dev/taxonomies/cwe/#cwe-22-path-traversal) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain)

**Fix:** Call extractall(path, filter='data') or iterate members and refuse absolute paths, '..', and links leaving the target directory.

**References:** [https://docs.python.org/3/library/tarfile.html#extraction-filters](https://docs.python.org/3/library/tarfile.html#extraction-filters)

## keryn.vfgap.jinja-from-string-py

`warning` python jinja2

Environment.from\_string compiles its argument as a template and a normal Environment is not sandboxed, so a template body that includes model or user text can run code. Render with a fixed template and pass the text as data, or use SandboxedEnvironment.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-1336](https://keryn.dev/rules/?cwe=CWE-1336) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Keep templates in files you control, pass dynamic text as variables, and use jinja2.sandbox.SandboxedEnvironment for any template you did not write.

**References:** [https://jinja.palletsprojects.com/en/stable/sandbox/](https://jinja.palletsprojects.com/en/stable/sandbox/)

## keryn.vfgap.django-mark-safe-non-literal-py

`warning` python django

mark\_safe tells Django not to escape the value, so model or user text passed through it is rendered as live HTML. Escape with format\_html or conditional\_escape, or sanitise before marking.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Build the markup with format\_html(), which escapes its arguments, or sanitise with an allow-list sanitiser before calling mark\_safe.

**References:** [https://docs.djangoproject.com/en/stable/ref/utils/#django.utils.safestring.mark_safe](https://docs.djangoproject.com/en/stable/ref/utils/#django.utils.safestring.mark_safe)

## keryn.vfgap.vm-run-dynamic-code-js

`error` javascript, typescript nodejs

The Node vm module is not a security boundary: code run through vm.runInThisContext, runInNewContext or runInContext (or a new vm.Script) can escape to the host. When the source text is built from model, tool or user input this is code execution. Use a separate process or isolate with no secrets.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Run untrusted code in an isolated process, container or isolated-vm, and never pass model output to the vm module.

**References:** [https://nodejs.org/api/vm.html#vm-executing-javascript](https://nodejs.org/api/vm.html#vm-executing-javascript)

## keryn.vfgap.node-serialize-unserialize-js

`error` javascript, typescript node-serialize

node-serialize's unserialize evaluates function expressions embedded in the serialized text, so any attacker- controlled string is remote code execution (the library is unmaintained for this reason). Use JSON.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Replace node-serialize with JSON.stringify / JSON.parse and a schema check.

**References:** [https://github.com/luin/serialize#readme](https://github.com/luin/serialize#readme)

## keryn.vfgap.tls-reject-unauthorized-false-js

`error` javascript, typescript nodejs

rejectUnauthorized: false (or NODE\_TLS\_REJECT\_UNAUTHORIZED=0) makes Node accept any TLS certificate, so a network attacker can read or change the traffic, including API keys. Trust a CA bundle instead.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-295](https://keryn.dev/rules/?cwe=CWE-295) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)

**Fix:** Remove the option; for a private CA pass its certificate in the ca option.

**References:** [https://nodejs.org/api/tls.html#tlsconnectoptions-callback](https://nodejs.org/api/tls.html#tlsconnectoptions-callback)

## keryn.vfgap.function-constructor-call-js

`warning` javascript, typescript javascript

Calling Function(...) without new still compiles its string argument into code, exactly like eval. When the text contains model, tool or user data this is code execution. Parse a data format or dispatch to named functions instead.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Replace the call with a lookup table of allowed functions or a data parser.

**References:** [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)

## keryn.vfgap.child-process-exec-sync-js

`error` javascript, typescript nodejs

execSync and execAsync run their string through a shell, so any untrusted part of the command executes. Use execFileSync / spawn with an argument array and no shell.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Switch to execFileSync(program, [args]) with an allow-listed program and each argument separate.

**References:** [https://nodejs.org/api/child_process.html#child_processexecsynccommand-options](https://nodejs.org/api/child_process.html#child_processexecsynccommand-options)

## keryn.vfgap.runtime-exec-non-literal-java

`error` java java

Runtime.exec with a string that is built at run time splits and runs attacker-influenced text as a command. Pass a fixed program and a separate argument array, and allow-list the program.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Use ProcessBuilder with a fixed executable and one array element per argument, never concatenating input into the command line.

**References:** [https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Runtime.html#exec(java.lang.String)](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Runtime.html#exec(java.lang.String))

## keryn.vfgap.process-builder-non-literal-java

`warning` java java

ProcessBuilder is created from a value that is not a literal. If any part of it comes from a model, tool or user, the program or its arguments are attacker-chosen; with sh -c it is a shell injection. Allow-list the program and keep arguments as separate elements.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Fix the executable path, validate every argument against an allow-list, and never pass a shell with a string built from input.

**References:** [https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ProcessBuilder.html](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ProcessBuilder.html)

## keryn.vfgap.xml-factory-without-hardening-java

`warning` java java

This XML factory is created and used with default settings in a method that never calls setFeature, setProperty or setAttribute on it. The defaults of the JDK parsers resolve external entities and DTDs, so a crafted document read from a tool, upload or fetched file can read local files or reach internal URLs (XXE). Disable DOCTYPEs and external access before parsing.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing.

[CWE-611](https://keryn.dev/rules/?cwe=CWE-611) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Call setFeature("`http://apache.org/xml/features/disallow-doctype-decl`", true) (or the factory's FEATURE\_SECURE\_PROCESSING and ACCESS\_EXTERNAL\_\* properties) on the factory right after creating it.

**References:** [https://docs.oracle.com/en/java/javase/21/security/java-api-xml-processing-jaxp-security-guide.html](https://docs.oracle.com/en/java/javase/21/security/java-api-xml-processing-jaxp-security-guide.html)

## keryn.vfgap.xmldecoder-java

`error` java java

java.beans.XMLDecoder executes the method calls and constructors a document describes, so reading an XML file or stream from outside is code execution. Use a data-only parser.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Parse the XML with a hardened parser into plain data objects; remove XMLDecoder.

**References:** [https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/beans/XMLDecoder.html](https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/beans/XMLDecoder.html)

## keryn.vfgap.xstream-from-xml-java

`error` java xstream

XStream.fromXML rebuilds arbitrary Java objects from XML and has a long history of gadget-chain code execution unless a type allow-list is installed. Call allowTypes / addPermission before unmarshalling anything from outside.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Configure XStream with allowTypes(...) for exactly the classes you expect (XStream.setupDefaultSecurity plus an allow-list) or use a data-only format.

**References:** [https://x-stream.github.io/security.html](https://x-stream.github.io/security.html)

## keryn.vfgap.snakeyaml-unsafe-load-java

`error` java snakeyaml

A SnakeYAML Yaml built with its default constructor can instantiate any class named by a tag in the document, so loading untrusted YAML runs code. Construct it with new Yaml(new SafeConstructor(new LoaderOptions())).

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Create the parser with SafeConstructor (or a TagInspector allow-list in 2.x) before calling load.

**References:** [https://bitbucket.org/snakeyaml/snakeyaml/wiki/CVE%20&amp;%20Vulnerabilities](https://bitbucket.org/snakeyaml/snakeyaml/wiki/CVE%20&%20Vulnerabilities)

## keryn.vfgap.object-input-stream-java

`warning` java java

ObjectInputStream.readObject runs the deserialization logic of every class on the classpath that the stream names, which is how most Java deserialization gadget chains execute. Never read one from an untrusted source; install an ObjectInputFilter allow-list.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Use a data format (JSON, protobuf) or set an ObjectInputFilter (setObjectInputFilter) that admits only the classes you expect.

**References:** [https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/ObjectInputStream.html](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/ObjectInputStream.html)

## keryn.vfgap.script-engine-eval-java

`error` java java

ScriptEngine.eval runs its argument as script code with access to the JVM. When the text is built from model, tool or user input that is code execution.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Avoid script engines for dynamic input; if a rules language is needed, use a sandboxed expression evaluator with an allow-list.

**References:** [https://docs.oracle.com/en/java/javase/21/docs/api/java.scripting/javax/script/ScriptEngine.html](https://docs.oracle.com/en/java/javase/21/docs/api/java.scripting/javax/script/ScriptEngine.html)

## keryn.vfgap.insecure-formatter-deserialization-cs

`error` csharp dotnet

BinaryFormatter, LosFormatter, SoapFormatter, ObjectStateFormatter and NetDataContractSerializer deserialize arbitrary .NET types and cannot be made safe for untrusted data (Microsoft marks them obsolete). Switch to System.Text.Json or another data-only serializer.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Replace with System.Text.Json, DataContractSerializer with known types, or protobuf; do not deserialize with these formatters at all.

**References:** [https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide](https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide)

## keryn.vfgap.json-net-typenamehandling-cs

`error` csharp dotnet, newtonsoft

TypeNameHandling set to All, Auto, Objects or Arrays lets the JSON document name the .NET type to create, which is a well-known gadget-chain path to code execution when the JSON is untrusted. Keep it None or use a SerializationBinder allow-list.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Set TypeNameHandling.None (the default), or restrict types with a custom ISerializationBinder that allow-lists exactly your DTOs.

**References:** [https://www.newtonsoft.com/json/help/html/SerializationSettings.htm#TypeNameHandling](https://www.newtonsoft.com/json/help/html/SerializationSettings.htm#TypeNameHandling)

## keryn.vfgap.process-start-non-literal-cs

`warning` csharp dotnet

Process.Start is called with a value that is not a literal. If the file name or arguments come from a model, tool or user, the caller chooses what runs. Allow-list the executable and pass arguments through ArgumentList.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Fix the executable, validate arguments against an allow-list, and use ProcessStartInfo.ArgumentList rather than a concatenated string.

**References:** [https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.start](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.start)

## keryn.vfgap.exec-command-shell-go

`error` go go

exec.Command is started with sh or bash -c and a command string that is not a literal. Any untrusted part of the string runs as shell. Call the program directly with its arguments as separate values.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Replace sh -c with exec.Command(program, args...) and allow-list the program.

**References:** [https://pkg.go.dev/os/exec#Command](https://pkg.go.dev/os/exec#Command)

## keryn.vfgap.tls-insecure-skip-verify-go

`error` go go

InsecureSkipVerify: true makes the TLS client accept any certificate and host name, so a network attacker can read or alter the traffic. Verify certificates and supply a RootCAs pool for private CAs.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-295](https://keryn.dev/rules/?cwe=CWE-295) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)

**Fix:** Delete InsecureSkipVerify (default false) and set RootCAs for a private CA.

**References:** [https://pkg.go.dev/crypto/tls#Config](https://pkg.go.dev/crypto/tls#Config)

## keryn.vfgap.weak-cipher-des-rc4-go

`warning` go go

DES, 3DES and RC4 are broken or deprecated ciphers (56-bit keys, 64-bit blocks, biased keystream). Use AES-GCM or ChaCha20-Poly1305.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: none a property of one thing, not a relationship between two.

[CWE-327](https://keryn.dev/taxonomies/cwe/#cwe-327) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)

**Fix:** Switch to aes.NewCipher with cipher.NewGCM, or chacha20poly1305.

**References:** [https://pkg.go.dev/crypto/des](https://pkg.go.dev/crypto/des)

## keryn.vfgap.template-html-conversion-go

`warning` go go

template.HTML(x) tells html/template not to escape x. When x holds model, tool or user text it renders as live markup. Pass plain strings to the template and let it escape, or sanitise first.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Remove the template.HTML conversion for dynamic values, or run them through an HTML sanitiser (bluemonday) first.

**References:** [https://pkg.go.dev/html/template#HTML](https://pkg.go.dev/html/template#HTML)

## keryn.vfgap.shell-process-functions-php

`error` php php

proc\_open and popen start a process from a command string that is not a literal. Any untrusted part of it runs as shell. Pass an argument array (proc\_open) and escape what remains with escapeshellarg.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Use proc\_open with an array command, allow-list the program, and wrap every dynamic argument in escapeshellarg.

**References:** [https://www.php.net/manual/en/function.proc-open.php](https://www.php.net/manual/en/function.proc-open.php)

## keryn.vfgap.assert-string-eval-php

`warning` php php

Before PHP 8, assert() evaluated a string argument as PHP code. Passing a variable here executes whatever it holds. Assert on a boolean expression instead.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-95](https://keryn.dev/rules/?cwe=CWE-95) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Pass a boolean expression, not a string, and remove assert() from production paths.

**References:** [https://www.php.net/manual/en/function.assert.php](https://www.php.net/manual/en/function.assert.php)

## keryn.vfgap.create-function-php

`error` php php

create\_function compiles its string arguments with eval semantics (and is removed in PHP 8). Any dynamic text in the body is code injection. Use a closure.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-95](https://keryn.dev/rules/?cwe=CWE-95) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Replace create\_function with an anonymous function (function () use (...) &#123; ... &#125;).

**References:** [https://www.php.net/manual/en/function.create-function.php](https://www.php.net/manual/en/function.create-function.php)
