CodeQL-Informed Audit Heuristics
Purpose
Provide a language-specific reference of dangerous sinks, sources, and patterns that
security auditors should prioritize during manual code review. These heuristics are derived
from the CodeQL Community Packs — the same query suites used by GitHub Advanced Security
to find real vulnerabilities at scale.
Use this skill as a checklist companion during manual audit. It tells you what to look for
in each language. The actual manual reasoning is done by eresus-manual-security-audit.
Java / Kotlin
Command Injection
Runtime.exec(), ProcessBuilder.command()
Runtime.getRuntime().exec(userInput)
JNDI Injection
InitialContext.lookup(userInput)
Context.lookup() with attacker-controlled LDAP/RMI URLs
Expression Language Injection
SpELExpressionParser.parseExpression(userInput)
OGNL.getValue(userInput)
MVEL.eval(userInput)
SQL Injection
Statement.execute(query) with string concatenation
Statement.executeQuery("SELECT ... " + userInput)
- JPA
createNativeQuery() with interpolated strings
- MyBatis
${} (raw) vs #{} (parameterized)
Deserialization
ObjectInputStream.readObject()
XStream.fromXML()
Kryo.readObject()
- Jackson
@JsonTypeInfo with MINIMAL_CLASS / CLASS
XXE
DocumentBuilderFactory without setFeature(XMLConstants.FEATURE_SECURE_PROCESSING)
SAXParserFactory without disabling external entities
XMLInputFactory without disabling DTDs
Unsafe Reflection
Class.forName(userInput).newInstance()
Method.invoke() with user-controlled method names
Path Traversal
new File(basePath + userInput) without canonicalization
Paths.get(userInput) without restricting to base directory
Python
Command Injection
os.system(userInput)
subprocess.Popen(userInput, shell=True)
subprocess.call(userInput, shell=True)
os.popen(userInput)
Code Injection
eval(userInput)
exec(userInput)
compile(userInput, ...)
Deserialization
pickle.loads(userInput)
pickle.load(untrustedFile)
yaml.load(userInput) — safe: yaml.safe_load()
shelve.open(userInput)
marshal.loads(userInput)
Template Injection (SSTI)
jinja2.Template(userInput).render()
jinja2.Environment(autoescape=False)
mako.template.Template(userInput)
SQL Injection
cursor.execute("SELECT ... " + userInput)
- Django
extra(), raw(), RawSQL() with user input
- SQLAlchemy
text(userInput)
Path Traversal
open(basePath + userInput)
- Flask
send_file(userInput)
- FastAPI
FileResponse(userInput)
os.path.join(base, userInput) without os.path.realpath() check
SSRF
requests.get(userInput)
urllib.request.urlopen(userInput)
JavaScript / TypeScript
Code Injection
eval(userInput)
Function(userInput)()
setTimeout(userInput, ms) (string form)
setInterval(userInput, ms) (string form)
vm.runInNewContext(userInput)
vm.runInThisContext(userInput)
Command Injection
child_process.exec(userInput)
child_process.execSync(userInput)
child_process.exec(`cmd ${userInput}`)
XSS / DOM Injection
element.innerHTML = userInput
element.outerHTML = userInput
document.write(userInput)
insertAdjacentHTML('beforeend', userInput)
- React:
dangerouslySetInnerHTML={{ __html: userInput }}
- Vue:
v-html="userInput"
- Angular:
bypassSecurityTrustHtml(userInput)
Prototype Pollution
lodash.merge({}, userInput)
lodash.set(obj, userInput.key, userInput.value)
Object.assign(target, JSON.parse(userInput))
- Deep clone/merge with
__proto__, constructor.prototype keys
NoSQL Injection
- MongoDB
$where: userInput
collection.find({ field: userInput }) when userInput is { $gt: "" }
collection.find(JSON.parse(userInput))
Path Traversal
path.join(base, userInput) without path.resolve() + prefix check
fs.readFile(userInput)
- Express
res.sendFile(userInput)
postMessage
window.addEventListener('message', handler) without event.origin check
SSRF
fetch(userInput), axios.get(userInput), got(userInput)
- URL construction:
fetch(\/api/${userInput}`)`
Go
Command Injection
exec.Command(userInput)
exec.CommandContext(ctx, userInput)
os.StartProcess(userInput, ...)
SQL Injection
db.Query("SELECT ... " + userInput)
db.Exec("INSERT INTO ... " + userInput)
fmt.Sprintf("SELECT ... %s", userInput) passed to db.Query()
Template Injection
text/template (NO auto-escaping) vs html/template (auto-escapes)
template.HTML(userInput) explicitly marking user input as safe
Path Traversal
filepath.Join(base, userInput) — does NOT prevent ../
os.Open(userInput) without validation
- Need:
filepath.Rel() or prefix check after filepath.Clean()
TLS Misconfiguration
InsecureSkipVerify: true
MinVersion: tls.VersionTLS10
SSRF
http.Get(userInput)
http.NewRequest("GET", userInput, nil)
Ruby
Command Injection
system(userInput)
`#{userInput}` (backticks)
IO.popen(userInput)
Open3.capture3(userInput)
Kernel.exec(userInput)
Deserialization
Marshal.load(userInput) — RCE via universal gadget chain
YAML.load(userInput) — RCE via Psych → safe: YAML.safe_load()
Oj.load(userInput, mode: :object) — safe: mode: :strict
Ox.load(userInput, mode: :object) — safe: mode: :generic
SQL Injection
ActiveRecord: .where("column = '#{userInput}'")
ActiveRecord: .order(userInput)
ActiveRecord: .pluck(userInput)
ActiveRecord: .select(userInput)
Dynamic Dispatch
object.send(userInput) — calls any method
object.public_send(userInput) — calls any public method
Template Injection
ERB.new(userInput).result(binding)
Slim::Template.new { userInput }
Path Traversal
File.read(params[:file])
send_file(params[:path])
C# / .NET
Deserialization
BinaryFormatter.Deserialize(stream) — banned in .NET 9+
SoapFormatter.Deserialize(stream)
NetDataContractSerializer.ReadObject(reader)
ObjectStateFormatter.Deserialize(input)
LosFormatter.Deserialize(input)
XmlSerializer with polymorphic [XmlInclude] types
Command Injection
Process.Start(userInput)
Process.Start("cmd.exe", "/c " + userInput)
SQL Injection
new SqlCommand("SELECT ... " + userInput)
cmd.CommandText = "SELECT ... " + userInput
- EF Core
FromSqlRaw("SELECT ... " + userInput)
XSS
HtmlString(userInput) — bypasses Razor encoding
Html.Raw(userInput)
Unsafe Reflection
Type.GetType(userInput)
Activator.CreateInstance(Type.GetType(userInput))
Path Traversal
Path.Combine(basePath, userInput) without canonicalization
File.ReadAllText(userInput)
C / C++
Buffer Overflow
strcpy(dst, src) — safe: strncpy(), strlcpy()
strcat(dst, src) — safe: strncat()
sprintf(buf, fmt, ...) — safe: snprintf()
gets(buf) — never safe, removed in C11
Format String
printf(userInput) — safe: printf("%s", userInput)
fprintf(fp, userInput)
syslog(priority, userInput)
Integer Overflow
malloc(count * size) without overflow check
size_t arithmetic wrapping to zero
- Signed/unsigned comparison mismatches
Memory Safety
- Use-after-free: accessing memory after
free()
- Double-free: calling
free() twice on same pointer
- Null dereference: missing NULL checks after
malloc()
Command Injection
system(userInput)
popen(userInput, "r")
execvp(userInput, args)
Audit Priority Rules
When performing depth-first manual review, prioritize:
- Security-sensitive sinks over style issues
- Exploitable paths over theoretical vulnerabilities
- Business logic flaws over pattern-match findings
- Trust boundary violations over defense-in-depth gaps
Tooling Constraints
Use ONLY these tools for code inspection:
view_file — read source code
grep_search — find pattern matches
Do NOT use terminal commands like grep, rg, cat, sed, or any shell-based tools.
1---
2name: eresus-codeql-heuristics
3description: >
4 Language-specific vulnerability hotspot reference for manual code audit.
5 Trigger when the user asks to: "what sinks should I look for in Java?", "Python security hotspots",
6 "dangerous functions in Go", "JavaScript injection patterns",
7 or when starting a manual audit of a specific language and needing a sink/source checklist.
8metadata:
9 source: https://skillmd.com/skills/aibot88/eresus-codeql-heuristics
10 version: "1.0"
11 domain: application-security
12 mode: reference
13 persona: security-researcher
14---
15
16# CodeQL-Informed Audit Heuristics
17
18## Purpose
19
20Provide a language-specific reference of dangerous sinks, sources, and patterns that
21security auditors should prioritize during manual code review. These heuristics are derived
22from the CodeQL Community Packs — the same query suites used by GitHub Advanced Security
23to find real vulnerabilities at scale.
24
25Use this skill as a **checklist companion** during manual audit. It tells you **what to look for**
26in each language. The actual manual reasoning is done by `eresus-manual-security-audit`.
27
28---
29
30## Java / Kotlin
31
32### Command Injection
33- `Runtime.exec()`, `ProcessBuilder.command()`
34- `Runtime.getRuntime().exec(userInput)`
35
36### JNDI Injection
37- `InitialContext.lookup(userInput)`
38- `Context.lookup()` with attacker-controlled LDAP/RMI URLs
39
40### Expression Language Injection
41- `SpELExpressionParser.parseExpression(userInput)`
42- `OGNL.getValue(userInput)`
43- `MVEL.eval(userInput)`
44
45### SQL Injection
46- `Statement.execute(query)` with string concatenation
47- `Statement.executeQuery("SELECT ... " + userInput)`
48- JPA `createNativeQuery()` with interpolated strings
49- MyBatis `${}` (raw) vs `#{}` (parameterized)
50
51### Deserialization
52- `ObjectInputStream.readObject()`
53- `XStream.fromXML()`
54- `Kryo.readObject()`
55- Jackson `@JsonTypeInfo` with `MINIMAL_CLASS` / `CLASS`
56
57### XXE
58- `DocumentBuilderFactory` without `setFeature(XMLConstants.FEATURE_SECURE_PROCESSING)`
59- `SAXParserFactory` without disabling external entities
60- `XMLInputFactory` without disabling DTDs
61
62### Unsafe Reflection
63- `Class.forName(userInput).newInstance()`
64- `Method.invoke()` with user-controlled method names
65
66### Path Traversal
67- `new File(basePath + userInput)` without canonicalization
68- `Paths.get(userInput)` without restricting to base directory
69
70---
71
72## Python
73
74### Command Injection
75- `os.system(userInput)`
76- `subprocess.Popen(userInput, shell=True)`
77- `subprocess.call(userInput, shell=True)`
78- `os.popen(userInput)`
79
80### Code Injection
81- `eval(userInput)`
82- `exec(userInput)`
83- `compile(userInput, ...)`
84
85### Deserialization
86- `pickle.loads(userInput)`
87- `pickle.load(untrustedFile)`
88- `yaml.load(userInput)` — safe: `yaml.safe_load()`
89- `shelve.open(userInput)`
90- `marshal.loads(userInput)`
91
92### Template Injection (SSTI)
93- `jinja2.Template(userInput).render()`
94- `jinja2.Environment(autoescape=False)`
95- `mako.template.Template(userInput)`
96
97### SQL Injection
98- `cursor.execute("SELECT ... " + userInput)`
99- Django `extra()`, `raw()`, `RawSQL()` with user input
100- SQLAlchemy `text(userInput)`
101
102### Path Traversal
103- `open(basePath + userInput)`
104- Flask `send_file(userInput)`
105- FastAPI `FileResponse(userInput)`
106- `os.path.join(base, userInput)` without `os.path.realpath()` check
107
108### SSRF
109- `requests.get(userInput)`
110- `urllib.request.urlopen(userInput)`
111
112---
113
114## JavaScript / TypeScript
115
116### Code Injection
117- `eval(userInput)`
118- `Function(userInput)()`
119- `setTimeout(userInput, ms)` (string form)
120- `setInterval(userInput, ms)` (string form)
121- `vm.runInNewContext(userInput)`
122- `vm.runInThisContext(userInput)`
123
124### Command Injection
125- `child_process.exec(userInput)`
126- `child_process.execSync(userInput)`
127- `` child_process.exec(`cmd ${userInput}`) ``
128
129### XSS / DOM Injection
130- `element.innerHTML = userInput`
131- `element.outerHTML = userInput`
132- `document.write(userInput)`
133- `insertAdjacentHTML('beforeend', userInput)`
134- React: `dangerouslySetInnerHTML={{ __html: userInput }}`
135- Vue: `v-html="userInput"`
136- Angular: `bypassSecurityTrustHtml(userInput)`
137
138### Prototype Pollution
139- `lodash.merge({}, userInput)`
140- `lodash.set(obj, userInput.key, userInput.value)`
141- `Object.assign(target, JSON.parse(userInput))`
142- Deep clone/merge with `__proto__`, `constructor.prototype` keys
143
144### NoSQL Injection
145- MongoDB `$where: userInput`
146- `collection.find({ field: userInput })` when userInput is `{ $gt: "" }`
147- `collection.find(JSON.parse(userInput))`
148
149### Path Traversal
150- `path.join(base, userInput)` without `path.resolve()` + prefix check
151- `fs.readFile(userInput)`
152- Express `res.sendFile(userInput)`
153
154### postMessage
155- `window.addEventListener('message', handler)` without `event.origin` check
156
157### SSRF
158- `fetch(userInput)`, `axios.get(userInput)`, `got(userInput)`
159- URL construction: `fetch(\`/api/${userInput}\`)`
160
161---
162
163## Go
164
165### Command Injection
166- `exec.Command(userInput)`
167- `exec.CommandContext(ctx, userInput)`
168- `os.StartProcess(userInput, ...)`
169
170### SQL Injection
171- `db.Query("SELECT ... " + userInput)`
172- `db.Exec("INSERT INTO ... " + userInput)`
173- `fmt.Sprintf("SELECT ... %s", userInput)` passed to `db.Query()`
174
175### Template Injection
176- `text/template` (NO auto-escaping) vs `html/template` (auto-escapes)
177- `template.HTML(userInput)` explicitly marking user input as safe
178
179### Path Traversal
180- `filepath.Join(base, userInput)` — does NOT prevent `../`
181- `os.Open(userInput)` without validation
182- Need: `filepath.Rel()` or prefix check after `filepath.Clean()`
183
184### TLS Misconfiguration
185- `InsecureSkipVerify: true`
186- `MinVersion: tls.VersionTLS10`
187
188### SSRF
189- `http.Get(userInput)`
190- `http.NewRequest("GET", userInput, nil)`
191
192---
193
194## Ruby
195
196### Command Injection
197- `system(userInput)`
198- `` `#{userInput}` `` (backticks)
199- `IO.popen(userInput)`
200- `Open3.capture3(userInput)`
201- `Kernel.exec(userInput)`
202
203### Deserialization
204- `Marshal.load(userInput)` — RCE via universal gadget chain
205- `YAML.load(userInput)` — RCE via Psych → safe: `YAML.safe_load()`
206- `Oj.load(userInput, mode: :object)` — safe: `mode: :strict`
207- `Ox.load(userInput, mode: :object)` — safe: `mode: :generic`
208
209### SQL Injection
210- `ActiveRecord: .where("column = '#{userInput}'")`
211- `ActiveRecord: .order(userInput)`
212- `ActiveRecord: .pluck(userInput)`
213- `ActiveRecord: .select(userInput)`
214
215### Dynamic Dispatch
216- `object.send(userInput)` — calls any method
217- `object.public_send(userInput)` — calls any public method
218
219### Template Injection
220- `ERB.new(userInput).result(binding)`
221- `Slim::Template.new { userInput }`
222
223### Path Traversal
224- `File.read(params[:file])`
225- `send_file(params[:path])`
226
227---
228
229## C# / .NET
230
231### Deserialization
232- `BinaryFormatter.Deserialize(stream)` — **banned in .NET 9+**
233- `SoapFormatter.Deserialize(stream)`
234- `NetDataContractSerializer.ReadObject(reader)`
235- `ObjectStateFormatter.Deserialize(input)`
236- `LosFormatter.Deserialize(input)`
237- `XmlSerializer` with polymorphic `[XmlInclude]` types
238
239### Command Injection
240- `Process.Start(userInput)`
241- `Process.Start("cmd.exe", "/c " + userInput)`
242
243### SQL Injection
244- `new SqlCommand("SELECT ... " + userInput)`
245- `cmd.CommandText = "SELECT ... " + userInput`
246- EF Core `FromSqlRaw("SELECT ... " + userInput)`
247
248### XSS
249- `HtmlString(userInput)` — bypasses Razor encoding
250- `Html.Raw(userInput)`
251
252### Unsafe Reflection
253- `Type.GetType(userInput)`
254- `Activator.CreateInstance(Type.GetType(userInput))`
255
256### Path Traversal
257- `Path.Combine(basePath, userInput)` without canonicalization
258- `File.ReadAllText(userInput)`
259
260---
261
262## C / C++
263
264### Buffer Overflow
265- `strcpy(dst, src)` — safe: `strncpy()`, `strlcpy()`
266- `strcat(dst, src)` — safe: `strncat()`
267- `sprintf(buf, fmt, ...)` — safe: `snprintf()`
268- `gets(buf)` — **never safe**, removed in C11
269
270### Format String
271- `printf(userInput)` — safe: `printf("%s", userInput)`
272- `fprintf(fp, userInput)`
273- `syslog(priority, userInput)`
274
275### Integer Overflow
276- `malloc(count * size)` without overflow check
277- `size_t` arithmetic wrapping to zero
278- Signed/unsigned comparison mismatches
279
280### Memory Safety
281- Use-after-free: accessing memory after `free()`
282- Double-free: calling `free()` twice on same pointer
283- Null dereference: missing NULL checks after `malloc()`
284
285### Command Injection
286- `system(userInput)`
287- `popen(userInput, "r")`
288- `execvp(userInput, args)`
289
290---
291
292## Audit Priority Rules
293
294When performing depth-first manual review, prioritize:
295
2961. **Security-sensitive sinks** over style issues
2972. **Exploitable paths** over theoretical vulnerabilities
2983. **Business logic flaws** over pattern-match findings
2994. **Trust boundary violations** over defense-in-depth gaps
300
301---
302
303## Tooling Constraints
304
305Use ONLY these tools for code inspection:
306- `view_file` — read source code
307- `grep_search` — find pattern matches
308
309Do NOT use terminal commands like `grep`, `rg`, `cat`, `sed`, or any shell-based tools.