Skip to content

Commit 03e06dc

Browse files
committed
fix(stuff): wip
♬ Park Jeong Eun - Here He Is
1 parent 5c479b1 commit 03e06dc

34 files changed

Lines changed: 1336 additions & 194 deletions

‎Cargo.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ tree-sitter-rust = "0.23"
8989
tree-sitter-python = "0.23"
9090
tree-sitter-javascript = "0.23"
9191
tree-sitter-php = "0.23"
92+
tree-sitter-go = "0.23"
93+
tree-sitter-java = "0.23"
94+
tree-sitter-ruby = "0.23"
95+
tree-sitter-c-sharp = "0.23"
9296

9397
# Static analysis support
9498

‎config.example.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ enable_cve_bootstrap = true
102102
enable_variant_search = true
103103
# Domain-routed hunt prompts: select per-attack-class prompt modules from
104104
# prompts/hunt/ based on the target's languages during LLM discovery
105-
# Default: false
106-
enable_hunt_prompts = false
105+
# Default: true
106+
enable_hunt_prompts = true
107107

108108
# LLM configuration with per-phase settings
109109
[llm]

‎docs/architecture.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ See technique #5 in [`docs/argus-analysis.md`](argus-analysis.md).
122122

123123
### Domain-Routed Hunt Prompts (Discovery Phase)
124124

125-
Per-attack-class prompt modules from `prompts/hunt/` (injection, auth, authz_absence, xss, path_traversal, crypto, resource, deserialization, memory_safety) selected by target languages and appended to discovery prompts. Each module includes scope/lane discipline sections; the verification prompt has a skeptical self-refutation gate + untrusted-content framing.
125+
Per-attack-class prompt modules from `prompts/hunt/` (injection, auth, authz_absence, xss, path_traversal, crypto, resource, deserialization, memory_safety) selected by target languages and appended to discovery prompts. Each module includes scope/lane discipline sections; the verification prompt has a skeptical self-refutation gate + untrusted-content framing. Hunt prompts are enabled by default (`enable_hunt_prompts = true`).
126126

127127
Configured via `[scanner.performance] enable_hunt_prompts = true`.
128128

‎docs/configuration.md‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,15 +673,26 @@ Per-attack-class prompt modules from `prompts/hunt/` selected by target language
673673

674674
| Field | Type | Default | Description |
675675
|-------|------|---------|-------------|
676-
| `enable_hunt_prompts` | bool | `false` | Enable domain-routed hunt prompts |
676+
| `enable_hunt_prompts` | bool | `true` | Enable domain-routed hunt prompts |
677677

678678
```toml
679679
[scanner.performance]
680-
enable_hunt_prompts = false
680+
enable_hunt_prompts = true
681681
```
682682

683683
Available modules: `injection.md`, `auth.md`, `authz_absence.md`, `xss.md`, `path_traversal.md`, `crypto.md`, `resource.md`, `deserialization.md`, `memory_safety.md`.
684684

685+
### Taint rules are derived from the project languages
686+
687+
Taint rules are always merged from the project languages (python, javascript/typescript, go, php, c/cpp, java, ruby, csharp). Explicit `custom_rules` no longer suppress them; when a rule id exists in both, the explicit one wins.
688+
689+
CWE classes covered per language:
690+
- **SQLi**: CWE-89 (all languages)
691+
- **Command injection**: CWE-78 (all languages)
692+
- **Path traversal**: CWE-22 (all languages)
693+
- **Deserialization**: CWE-502 (php, java, csharp)
694+
- **Code injection**: CWE-94 (ruby)
695+
685696
### Exploit Synthesis (T3.2)
686697

687698
Automated exploit generation to verify findings. Runs in sandboxed Docker containers.

‎presets/go.toml‎

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -55,61 +55,12 @@ rules:
5555
pattern-either:
5656
- pattern: exec.Command($CMD)
5757
- pattern: exec.CommandContext($CTX, $CMD)
58-
59-
- id: go-taint-sqli-high
60-
languages: [go]
61-
mode: taint
62-
severity: ERROR
63-
message: >
64-
User input flows into database query without sanitization, SQL injection risk.
65-
metadata:
66-
cwe:
67-
- "CWE-89: Improper Neutralization of Special Elements used in an SQL Command"
68-
pattern-sources:
69-
- pattern: r.URL.Query().Get($KEY)
70-
- pattern: r.FormValue($KEY)
71-
- pattern: r.PostFormValue($KEY)
72-
pattern-sinks:
73-
- pattern: db.Query($SQL)
74-
- pattern: db.Exec($SQL)
75-
- pattern: db.QueryRow($SQL)
76-
- pattern: db.Prepare($SQL)
77-
78-
- id: go-taint-cmdi-high
79-
languages: [go]
80-
mode: taint
81-
severity: ERROR
82-
message: >
83-
User input flows into command execution without sanitization, command injection risk.
84-
metadata:
85-
cwe:
86-
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
87-
pattern-sources:
88-
- pattern: r.URL.Query().Get($KEY)
89-
pattern-sinks:
90-
- pattern: exec.Command($CMD)
91-
92-
- id: go-taint-path-traversal-high
93-
languages: [go]
94-
mode: taint
95-
severity: ERROR
96-
message: >
97-
User input flows into file operations without validation, path traversal risk.
98-
metadata:
99-
cwe:
100-
- "CWE-22: Improper Limitation of a Pathname to a Restricted Directory"
101-
pattern-sources:
102-
- pattern: r.URL.Query().Get($KEY)
103-
pattern-sinks:
104-
- pattern: os.Open($PATH)
105-
- pattern: os.ReadFile($PATH)
106-
- pattern: os.Create($PATH)
107-
- pattern: os.Remove($PATH)
10858
''']
10959

11060
[scanner.performance]
11161
enable_variant_search = true
11262
enable_cve_bootstrap = true
63+
enable_hunt_prompts = true
11364

11465
[llm]
11566
temperature = 0.2

‎presets/javascript.toml‎

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -87,62 +87,12 @@ rules:
8787
cwe:
8888
- "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
8989
pattern: crypto.createHash("md5", $VAR)
90-
91-
- id: js-taint-sqli-high
92-
languages: [javascript, typescript]
93-
mode: taint
94-
severity: ERROR
95-
message: >
96-
User input flows into database query without sanitization, SQL injection risk.
97-
metadata:
98-
cwe:
99-
- "CWE-89: Improper Neutralization of Special Elements used in an SQL Command"
100-
pattern-sources:
101-
- pattern: req.query[$X]
102-
- pattern: req.body[$X]
103-
- pattern: req.params[$X]
104-
pattern-sinks:
105-
- pattern: db.query($SQL)
106-
- pattern: connection.query($SQL)
107-
- pattern: pool.query($SQL)
108-
109-
- id: js-taint-cmdi-high
110-
languages: [javascript, typescript]
111-
mode: taint
112-
severity: ERROR
113-
message: >
114-
User input flows into command execution without sanitization, command injection risk.
115-
metadata:
116-
cwe:
117-
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
118-
pattern-sources:
119-
- pattern: req.query[$X]
120-
- pattern: req.body[$X]
121-
pattern-sinks:
122-
- pattern: child_process.exec($CMD)
123-
- pattern: execSync($CMD)
124-
125-
- id: js-taint-path-traversal-high
126-
languages: [javascript, typescript]
127-
mode: taint
128-
severity: ERROR
129-
message: >
130-
User input flows into file operations without validation, path traversal risk.
131-
metadata:
132-
cwe:
133-
- "CWE-22: Improper Limitation of a Pathname to a Restricted Directory"
134-
pattern-sources:
135-
- pattern: req.query[$X]
136-
- pattern: req.params[$X]
137-
pattern-sinks:
138-
- pattern: fs.readFile($PATH)
139-
- pattern: fs.writeFile($PATH, $DATA)
140-
- pattern: fs.unlink($PATH)
14190
''']
14291

14392
[scanner.performance]
14493
enable_variant_search = true
14594
enable_cve_bootstrap = true
95+
enable_hunt_prompts = true
14696

14797
[llm]
14898
temperature = 0.2

‎presets/oss-python.toml‎

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -40,63 +40,9 @@ exclude_paths = [
4040

4141
[scanner.semgrep]
4242
rulesets = ["p/python", "p/bandit", "p/security"]
43-
custom_rules = ['''
44-
rules:
45-
- id: py-taint-sqli-high
46-
languages: [python]
47-
mode: taint
48-
severity: ERROR
49-
message: >
50-
User input flows into database query without sanitization, SQL injection risk.
51-
metadata:
52-
cwe:
53-
- "CWE-89: Improper Neutralization of Special Elements used in an SQL Command"
54-
pattern-sources:
55-
- pattern: request.args.get($KEY)
56-
- pattern: request.form.get($KEY)
57-
- pattern: request.values.get($KEY)
58-
- pattern: request.json.get($KEY)
59-
pattern-sinks:
60-
- pattern: cursor.execute($SQL)
61-
- pattern: session.execute($SQL)
62-
- pattern: db.execute($SQL)
63-
64-
- id: py-taint-cmdi-high
65-
languages: [python]
66-
mode: taint
67-
severity: ERROR
68-
message: >
69-
User input flows into command execution without sanitization, command injection risk.
70-
metadata:
71-
cwe:
72-
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
73-
pattern-sources:
74-
- pattern: request.args.get($KEY)
75-
- pattern: request.form.get($KEY)
76-
pattern-sinks:
77-
- pattern: subprocess.call($CMD, shell=True)
78-
- pattern: subprocess.Popen($CMD, shell=True)
79-
- pattern: os.system($CMD)
80-
81-
- id: py-taint-path-traversal-high
82-
languages: [python]
83-
mode: taint
84-
severity: ERROR
85-
message: >
86-
User input flows into file operations without validation, path traversal risk.
87-
metadata:
88-
cwe:
89-
- "CWE-22: Improper Limitation of a Pathname to a Restricted Directory"
90-
pattern-sources:
91-
- pattern: request.args.get($KEY)
92-
- pattern: request.form.get($KEY)
93-
pattern-sinks:
94-
- pattern: open($PATH)
95-
- pattern: os.open($PATH, $MODE)
96-
''']
9743

9844
[scanner.performance]
99-
45+
enable_hunt_prompts = true
10046
[llm]
10147
enable_llm_cache = true
10248

‎src/config/phases.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ pub const DEFAULT_ENABLE_MERGE_ORDER_DETECTION: bool = true;
9090
pub fn default_enable_merge_order_detection() -> bool {
9191
DEFAULT_ENABLE_MERGE_ORDER_DETECTION
9292
}
93+
pub const DEFAULT_ENABLE_HUNT_PROMPTS: bool = true;
94+
pub fn default_enable_hunt_prompts() -> bool {
95+
DEFAULT_ENABLE_HUNT_PROMPTS
96+
}
9397
/// Normalization tier for confidence calibration.
9498
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, PartialEq, Default)]
9599
pub enum NormalizationTier {

‎src/config/scanner.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub struct PerformanceSettings {
112112
pub enable_merge_order_detection: bool,
113113
/// Domain-routed hunt prompts: select per-attack-class prompt modules
114114
/// from the target's languages during LLM discovery
115-
#[serde(default)]
115+
#[serde(default = "crate::config::default_enable_hunt_prompts")]
116116
pub enable_hunt_prompts: bool,
117117
/// Never-submit pattern filter - heavily penalizes findings matching known false-positive patterns
118118
#[serde(default = "crate::config::default_never_submit_enabled")]
@@ -149,7 +149,7 @@ impl Default for PerformanceSettings {
149149
enable_variant_search: crate::config::default_enable_variant_search(),
150150
enable_absence_detection: crate::config::default_enable_absence_detection(),
151151
enable_merge_order_detection: crate::config::default_enable_merge_order_detection(),
152-
enable_hunt_prompts: false,
152+
enable_hunt_prompts: crate::config::default_enable_hunt_prompts(),
153153
never_submit_enabled: crate::config::default_never_submit_enabled(),
154154
never_submit_multiplier: crate::config::default_never_submit_multiplier(),
155155
variant_search_patterns: Vec::new(),

‎src/llm_analysis.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ fn is_function_like(kind: &str) -> bool {
114114
| "method_definition"
115115
| "function_declaration"
116116
| "function_item"
117+
| "method"
117118
)
118119
}
119120

@@ -708,6 +709,10 @@ fn tree_sitter_language(language: &str) -> Option<tree_sitter::Language> {
708709
"python" => Some(tree_sitter_python::LANGUAGE.into()),
709710
"javascript" | "typescript" | "tsx" => Some(tree_sitter_javascript::LANGUAGE.into()),
710711
"php" => Some(tree_sitter_php::LANGUAGE_PHP.into()),
712+
"go" => Some(tree_sitter_go::LANGUAGE.into()),
713+
"java" => Some(tree_sitter_java::LANGUAGE.into()),
714+
"ruby" => Some(tree_sitter_ruby::LANGUAGE.into()),
715+
"csharp" | "c#" | "cs" => Some(tree_sitter_c_sharp::LANGUAGE.into()),
711716
_ => None,
712717
}
713718
}

0 commit comments

Comments
 (0)