circle-ir 4.7.2 → 4.9.7

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.
Files changed (40) hide show
  1. package/dist/analysis/config-loader.d.ts.map +1 -1
  2. package/dist/analysis/config-loader.js +34 -0
  3. package/dist/analysis/config-loader.js.map +1 -1
  4. package/dist/analysis/passes/insecure-cookie-pass.d.ts +1 -0
  5. package/dist/analysis/passes/insecure-cookie-pass.d.ts.map +1 -1
  6. package/dist/analysis/passes/insecure-cookie-pass.js +37 -3
  7. package/dist/analysis/passes/insecure-cookie-pass.js.map +1 -1
  8. package/dist/analysis/passes/insecure-deserialization-config-pass.d.ts +2 -0
  9. package/dist/analysis/passes/insecure-deserialization-config-pass.d.ts.map +1 -1
  10. package/dist/analysis/passes/insecure-deserialization-config-pass.js +45 -2
  11. package/dist/analysis/passes/insecure-deserialization-config-pass.js.map +1 -1
  12. package/dist/analysis/passes/jwt-verify-disabled-pass.d.ts.map +1 -1
  13. package/dist/analysis/passes/jwt-verify-disabled-pass.js +48 -21
  14. package/dist/analysis/passes/jwt-verify-disabled-pass.js.map +1 -1
  15. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  16. package/dist/analysis/passes/language-sources-pass.js +131 -0
  17. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  18. package/dist/analysis/passes/tls-verify-disabled-pass.d.ts.map +1 -1
  19. package/dist/analysis/passes/tls-verify-disabled-pass.js +34 -0
  20. package/dist/analysis/passes/tls-verify-disabled-pass.js.map +1 -1
  21. package/dist/analysis/passes/weak-crypto-pass.d.ts.map +1 -1
  22. package/dist/analysis/passes/weak-crypto-pass.js +32 -19
  23. package/dist/analysis/passes/weak-crypto-pass.js.map +1 -1
  24. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  25. package/dist/analysis/taint-matcher.js +293 -25
  26. package/dist/analysis/taint-matcher.js.map +1 -1
  27. package/dist/analyzer.d.ts.map +1 -1
  28. package/dist/analyzer.js +14 -0
  29. package/dist/analyzer.js.map +1 -1
  30. package/dist/browser/circle-ir.js +660 -109
  31. package/dist/core/circle-ir-core.cjs +411 -68
  32. package/dist/core/circle-ir-core.js +411 -68
  33. package/dist/core/extractors/calls.js +17 -3
  34. package/dist/core/extractors/calls.js.map +1 -1
  35. package/dist/core/extractors/cfg.d.ts.map +1 -1
  36. package/dist/core/extractors/cfg.js +140 -40
  37. package/dist/core/extractors/cfg.js.map +1 -1
  38. package/dist/core/extractors/types.js +77 -2
  39. package/dist/core/extractors/types.js.map +1 -1
  40. 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,MAA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B1C,CAAC;AA+KF,eAAO,MAAM,aAAa,EAAE,WAAW,EAoiEtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAuiBhD,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"}
@@ -2620,6 +2620,11 @@ export const DEFAULT_SINKS = [
2620
2620
  // ADO.NET `cmd.CommandText = "…" + x` — emitted as a synthetic call by
2621
2621
  // extractCSharpCalls (property-assignment sink; the ctor-arg sink misses it).
2622
2622
  { method: 'CommandText', type: 'sql_injection', cwe: 'CWE-89', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2623
+ // `DirectorySearcher.Filter = "(uid=" + x + ")"` — LDAP injection (cognium-ai#272).
2624
+ // Emitted as a synthetic call by extractCSharpCalls ONLY when the receiver
2625
+ // resolves to a DirectorySearcher, so this classless entry never over-matches
2626
+ // other `.Filter =` assignments (DataView/BindingSource/collection filters).
2627
+ { method: 'Filter', type: 'ldap_injection', cwe: 'CWE-90', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2623
2628
  // ADO.NET `cmd.Execute*()` — object-carried sink (cognium-dev#271). The taint
2624
2629
  // rides the SqlCommand receiver (CommandText set from tainted data); the
2625
2630
  // receiver is surfaced as arg[0] by extractCSharpCalls, and the command object
@@ -2636,6 +2641,9 @@ export const DEFAULT_SINKS = [
2636
2641
  // injectable — the second is the argv path where taint rides arg[1] (#276).
2637
2642
  { method: 'Start', class: 'Process', type: 'command_injection', cwe: 'CWE-78', severity: 'critical', arg_positions: [0, 1], languages: ['csharp'] },
2638
2643
  { method: 'ProcessStartInfo', type: 'command_injection', cwe: 'CWE-78', severity: 'critical', arg_positions: [0, 1], languages: ['csharp'] },
2644
+ // P/Invoke of libc `system(cmd)` — lowercase `system` in C# is virtually
2645
+ // always the imported shell entry point (cognium-ai#275 interop/IlPinvoke).
2646
+ { method: 'system', type: 'command_injection', cwe: 'CWE-78', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2639
2647
  // C# path traversal — System.IO file APIs (CWE-22). Distinctive method names.
2640
2648
  { method: 'ReadAllText', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2641
2649
  { method: 'ReadAllBytes', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
@@ -2664,6 +2672,9 @@ export const DEFAULT_SINKS = [
2664
2672
  { method: 'Delete', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2665
2673
  { method: 'GetFiles', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2666
2674
  { method: 'EnumerateFiles', class: 'Directory', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2675
+ // ASP.NET `ControllerBase.PhysicalFile(path, contentType)` serves a file from
2676
+ // an absolute disk path — attacker-controllable path is CWE-22 (cognium-ai#326/#275).
2677
+ { method: 'PhysicalFile', type: 'path_traversal', cwe: 'CWE-22', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2667
2678
  // C# SSRF — HttpClient / WebClient / WebRequest (CWE-918).
2668
2679
  { method: 'GetAsync', type: 'ssrf', cwe: 'CWE-918', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2669
2680
  { method: 'PostAsync', type: 'ssrf', cwe: 'CWE-918', severity: 'high', arg_positions: [0], languages: ['csharp'] },
@@ -2688,6 +2699,17 @@ export const DEFAULT_SINKS = [
2688
2699
  { method: 'Load', class: 'Assembly', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2689
2700
  { method: 'LoadFrom', class: 'Assembly', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2690
2701
  { method: 'LoadFile', class: 'Assembly', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2702
+ // C# server-side template injection (SSTI). Compiling an attacker-controlled
2703
+ // template string is arbitrary code execution — classified as code_injection
2704
+ // (CWE-94), matching how Python (Jinja2/Mako) and Node SSTI are modelled.
2705
+ // Restricted to DISTINCTIVE template-compile APIs so the generic
2706
+ // `Template.Parse` / `.Compile` names (int.Parse, Regex.Compile, …) are not
2707
+ // over-matched. Taint-gated: a constant template never fires. `RunCompile`
2708
+ // = RazorEngine; `CompileRenderStringAsync` = RazorLight; `Compile` is
2709
+ // class-scoped to Handlebars. (cognium-dev#273)
2710
+ { method: 'RunCompile', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2711
+ { method: 'CompileRenderStringAsync', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0, 1], languages: ['csharp'] },
2712
+ { method: 'Compile', class: 'Handlebars', type: 'code_injection', cwe: 'CWE-94', severity: 'critical', arg_positions: [0], languages: ['csharp'] },
2691
2713
  // C# insecure deserialization — the polymorphic BCL formatters that can
2692
2714
  // instantiate arbitrary types named in the payload (CWE-502, cognium-ai#318).
2693
2715
  // Each of these classes exists only to deserialize and is unsafe on untrusted
@@ -2702,6 +2724,14 @@ export const DEFAULT_SINKS = [
2702
2724
  { method: 'Raw', class: 'Html', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2703
2725
  { method: 'Write', class: 'Response', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2704
2726
  { method: 'HtmlString', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2727
+ // Blazor `new MarkupString(x)` renders its argument as raw HTML (the framework's
2728
+ // documented "trusted markup" escape hatch) — attacker-controlled input is XSS. (ca#275)
2729
+ { method: 'MarkupString', class: 'constructor', type: 'xss', cwe: 'CWE-79', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2730
+ // `String.Format(fmt, …)` with an attacker-controlled FORMAT string — CWE-134.
2731
+ // Taint-gated on arg 0 (the format), so ordinary `String.Format("...", user)` where
2732
+ // only an argument is tainted never fires. .NET composite formatting can't corrupt
2733
+ // memory, so medium (FormatException DoS / unintended arg access), unlike C printf.
2734
+ { method: 'Format', class: 'String', type: 'format_string', cwe: 'CWE-134', severity: 'medium', arg_positions: [0], languages: ['csharp'] },
2705
2735
  // C# LDAP injection — System.DirectoryServices (CWE-90). The user-built
2706
2736
  // filter is the constructor argument.
2707
2737
  { method: 'DirectorySearcher', type: 'ldap_injection', cwe: 'CWE-90', severity: 'high', arg_positions: [0], languages: ['csharp'] },
@@ -2740,6 +2770,10 @@ export const DEFAULT_SINKS = [
2740
2770
  { method: 'SelectSingleNode', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2741
2771
  { method: 'SelectNodes', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2742
2772
  { method: 'Compile', class: 'XPathExpression', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2773
+ // XPathNavigator.Select/Evaluate — class-scoped (both names collide with LINQ
2774
+ // `.Select`/`.Evaluate`, so they must resolve to an XPathNavigator receiver).
2775
+ { method: 'Select', class: 'XPathNavigator', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2776
+ { method: 'Evaluate', class: 'XPathNavigator', type: 'xpath_injection', cwe: 'CWE-643', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2743
2777
  // C# XXE — untrusted XML into a parser without DTD hardening (CWE-611).
2744
2778
  { method: 'LoadXml', type: 'xxe', cwe: 'CWE-611', severity: 'high', arg_positions: [0], languages: ['csharp'] },
2745
2779
  { method: 'Load', class: 'XmlDocument', type: 'xxe', cwe: 'CWE-611', severity: 'high', arg_positions: [0], languages: ['csharp'] },