circle-ir 4.9.28 → 4.9.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/config-loader.d.ts.map +1 -1
- package/dist/analysis/config-loader.js +40 -2
- package/dist/analysis/config-loader.js.map +1 -1
- package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
- package/dist/analysis/passes/language-sources-pass.js +54 -7
- package/dist/analysis/passes/language-sources-pass.js.map +1 -1
- package/dist/analysis/passes/taint-propagation-pass.js +117 -12
- package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
- package/dist/analysis/taint-matcher.d.ts.map +1 -1
- package/dist/analysis/taint-matcher.js +41 -0
- package/dist/analysis/taint-matcher.js.map +1 -1
- package/dist/browser/circle-ir.js +165 -24
- package/dist/core/circle-ir-core.cjs +85 -9
- package/dist/core/circle-ir-core.js +85 -9
- package/dist/core/extractors/calls.js +29 -1
- package/dist/core/extractors/calls.js.map +1 -1
- package/dist/core/extractors/types.js +50 -7
- package/dist/core/extractors/types.js.map +1 -1
- package/dist/types/config.d.ts +14 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/analysis/config-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,CAiB1E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG;IACtD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAcA;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAAE,GAC7B,kBAAkB,EAAE,CAQtB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,qBAAqB,GAAE,MAAM,EAAO,GACnC,WAAW,CAYb;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/analysis/config-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,CAiB1E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG;IACtD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAcA;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAAE,GAC7B,kBAAkB,EAAE,CAQtB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,qBAAqB,GAAE,MAAM,EAAO,GACnC,WAAW,CAYb;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,EAy0B1C,CAAC;AA+KF,eAAO,MAAM,aAAa,EAAE,WAAW,EAmpEtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAgjBhD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,EAiDtD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAO9C;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,EA8F5C,CAAC"}
|
|
@@ -137,6 +137,23 @@ export const DEFAULT_SOURCES = [
|
|
|
137
137
|
{ method: 'next', class: 'Scanner', type: 'io_input', severity: 'high', return_tainted: true },
|
|
138
138
|
{ method: 'nextInt', class: 'Scanner', type: 'io_input', severity: 'high', return_tainted: true },
|
|
139
139
|
// Database result sources
|
|
140
|
+
// C# I/O, network and database reads (cognium-dev#502). Mirrors the Java
|
|
141
|
+
// rows above one-for-one, including the severity split: console/file I/O is
|
|
142
|
+
// `io_input` at high, a database row read is `db_input` at medium. There is
|
|
143
|
+
// no separate confidence tier — `type` + `severity` IS the tier, exactly as
|
|
144
|
+
// for `BufferedReader.readLine` vs `ResultSet.getString`.
|
|
145
|
+
{ method: 'ReadLine', class: 'StreamReader', type: 'io_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
146
|
+
{ method: 'ReadLineAsync', class: 'StreamReader', type: 'io_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
147
|
+
{ method: 'ReadToEnd', class: 'StreamReader', type: 'io_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
148
|
+
{ method: 'ReadToEndAsync', class: 'StreamReader', type: 'io_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
149
|
+
// Socket and HTTP-client reads. `GetStream` / `AcceptTcpClient` /
|
|
150
|
+
// `OpenRead` return the channel; the read off it is covered by the
|
|
151
|
+
// StreamReader rows above, and seeding the channel too lets a flow form when
|
|
152
|
+
// the read is inlined.
|
|
153
|
+
{ method: 'GetStream', class: 'TcpClient', type: 'network_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
154
|
+
{ method: 'AcceptTcpClient', class: 'TcpListener', type: 'network_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
155
|
+
{ method: 'OpenRead', class: 'WebClient', type: 'network_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
156
|
+
{ method: 'DownloadString', class: 'WebClient', type: 'network_input', severity: 'high', return_tainted: true, languages: ['csharp'] },
|
|
140
157
|
{ method: 'getString', class: 'ResultSet', type: 'db_input', severity: 'medium', return_tainted: true },
|
|
141
158
|
{ method: 'getObject', class: 'ResultSet', type: 'db_input', severity: 'medium', return_tainted: true },
|
|
142
159
|
{ method: 'getInt', class: 'ResultSet', type: 'db_input', severity: 'medium', return_tainted: true },
|
|
@@ -2745,8 +2762,12 @@ export const DEFAULT_SINKS = [
|
|
|
2745
2762
|
{ method: 'OpenRead', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
|
|
2746
2763
|
{ method: 'OpenWrite', class: 'File', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
|
|
2747
2764
|
{ method: 'FileStream', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
|
|
2748
|
-
|
|
2749
|
-
|
|
2765
|
+
// #502: the `(Stream)` overload takes no path — `new StreamReader(tcp.GetStream())`
|
|
2766
|
+
// is not CWE-22. The `(string path)` overload still matches.
|
|
2767
|
+
{ method: 'StreamReader', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], safe_if_stream_arg_at: 0, languages: ['csharp'] },
|
|
2768
|
+
// #502: the `(Stream)` overload takes no path — `new StreamWriter(tcp.GetStream())`
|
|
2769
|
+
// is not CWE-22. The `(string path)` overload still matches.
|
|
2770
|
+
{ method: 'StreamWriter', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], safe_if_stream_arg_at: 0, languages: ['csharp'] },
|
|
2750
2771
|
// Remaining System.IO.File path APIs — class-scoped so they don't collide
|
|
2751
2772
|
// with unrelated methods. Copy/Move take a source AND destination path (both
|
|
2752
2773
|
// attacker-controllable → read-anywhere / write-anywhere), hence [0, 1].
|
|
@@ -2790,6 +2811,23 @@ export const DEFAULT_SINKS = [
|
|
|
2790
2811
|
// `new RestClient(userUrl)` points every later request at attacker-controlled
|
|
2791
2812
|
// infrastructure. Ctor arg 0, taint-gated.
|
|
2792
2813
|
{ method: 'RestClient', class: 'constructor', type: 'ssrf', cwe: 'CWE-918', severity: 'high', arg_positions: [0], languages: ['csharp'] },
|
|
2814
|
+
// C# code injection — CodeDOM runtime compilation (CWE-94), cognium-dev#503
|
|
2815
|
+
// part 2. `provider.CompileAssemblyFromSource(parameters, source)` compiles
|
|
2816
|
+
// and can then execute attacker-supplied C#, so the source argument is the
|
|
2817
|
+
// injection point. The signature is
|
|
2818
|
+
// `CompileAssemblyFromSource(CompilerParameters, params string[] sources)`,
|
|
2819
|
+
// so the sources begin at position 1 — position 0 is the options object.
|
|
2820
|
+
//
|
|
2821
|
+
// These rows are only useful together with the #530 StringBuilder
|
|
2822
|
+
// propagation fix: the Juliet CWE-94 corpus accumulates the compiled source
|
|
2823
|
+
// through `sb.Append(...)` and reads it back with `ToString()`, so before
|
|
2824
|
+
// that fix the sink registered but no taint ever reached it.
|
|
2825
|
+
{ method: 'CompileAssemblyFromSource', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [1, 2], languages: ['csharp'] },
|
|
2826
|
+
{ method: 'CompileAssemblyFromSourceBatch', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [1, 2], languages: ['csharp'] },
|
|
2827
|
+
// Roslyn's equivalent pair. `ParseText` turns text into a syntax tree and
|
|
2828
|
+
// `Create` compiles it; either is the point where attacker text becomes code.
|
|
2829
|
+
{ method: 'ParseText', class: 'CSharpSyntaxTree', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
|
|
2830
|
+
{ method: 'ParseText', class: 'SyntaxFactory', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
|
|
2793
2831
|
// C# code injection — dynamic script/assembly loading (CWE-94).
|
|
2794
2832
|
{ method: 'EvaluateAsync', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
|
|
2795
2833
|
{ method: 'RunAsync', class: 'CSharpScript', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
|