@elytrasec/engine 0.4.3 → 0.4.4
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/index.js +38 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3028,12 +3028,48 @@ var securityRules = [
|
|
|
3028
3028
|
title: "Potential command injection",
|
|
3029
3029
|
description: "Shell command built with string concatenation or template literals. Attacker-controlled input may escape the intended command.",
|
|
3030
3030
|
suggestion: "Use execFile() with an argument array or a library like execa that avoids shell interpretation.",
|
|
3031
|
-
|
|
3031
|
+
// Catches:
|
|
3032
|
+
// JS: exec(`ls ${dir}`), execSync("cmd " + x), spawn("...", ...)
|
|
3033
|
+
// Py: os.system(f"ping {host}"), os.popen("cmd " + x), subprocess.call("..." + x, shell=True)
|
|
3034
|
+
pattern: /(?:exec|execSync|spawn|spawnSync|system|popen|run|call|check_output|getoutput)\s*\(\s*(?:`[^`]*\$\{|[fF]"(?:[^"\\]|\\.)*\{|[fF]'(?:[^'\\]|\\.)*\{|"(?:[^"\\]|\\.)*"\s*\+|'(?:[^'\\]|\\.)*'\s*\+)/,
|
|
3032
3035
|
severity: "critical",
|
|
3033
3036
|
category: "security",
|
|
3034
3037
|
confidence: "medium",
|
|
3035
3038
|
languages: [...JS_TS, ...PY]
|
|
3036
3039
|
},
|
|
3040
|
+
{
|
|
3041
|
+
id: "cp-sec-python-eval",
|
|
3042
|
+
title: "Python eval() / exec() with dynamic input",
|
|
3043
|
+
description: "Python `eval()` or `exec()` executes arbitrary code from a string. Reachable via `request.args`, `request.form`, or any user-controlled variable, this is direct RCE.",
|
|
3044
|
+
suggestion: "Avoid eval/exec entirely. For arithmetic, use `ast.literal_eval`. For dispatch, use an explicit allow-list dict.",
|
|
3045
|
+
pattern: /\b(?:eval|exec)\s*\(\s*(?:request\.|input\s*\(|sys\.argv|os\.environ|[\w.]+\.(?:args|form|query|params|json|body))/,
|
|
3046
|
+
severity: "critical",
|
|
3047
|
+
category: "security",
|
|
3048
|
+
confidence: "high",
|
|
3049
|
+
languages: PY
|
|
3050
|
+
},
|
|
3051
|
+
{
|
|
3052
|
+
id: "cp-sec-python-eval-loose",
|
|
3053
|
+
title: "Python eval() / exec() call",
|
|
3054
|
+
description: "Python's `eval()` and `exec()` evaluate arbitrary code. Even when input looks trusted, these are common code-injection vectors.",
|
|
3055
|
+
suggestion: "Replace with `ast.literal_eval` (for data literals) or an explicit allow-list. If you must use eval, scope the globals/locals dict to empty.",
|
|
3056
|
+
pattern: /\b(?:eval|exec)\s*\(\s*(?!{|\[|'\)|"\)|None|globals|locals)/,
|
|
3057
|
+
severity: "high",
|
|
3058
|
+
category: "security",
|
|
3059
|
+
confidence: "low",
|
|
3060
|
+
languages: PY
|
|
3061
|
+
},
|
|
3062
|
+
{
|
|
3063
|
+
id: "cp-sec-go-path-traversal",
|
|
3064
|
+
title: "Go file read with unsanitized user input (path traversal)",
|
|
3065
|
+
description: "`ioutil.ReadFile` / `os.ReadFile` / `os.Open` constructed via concatenation with HTTP request data is path-traversal-vulnerable. Attackers pass `../../etc/passwd`.",
|
|
3066
|
+
suggestion: "Use `filepath.Clean` and verify the resolved path starts with the expected base directory. Better: maintain an allow-list of accepted file IDs.",
|
|
3067
|
+
pattern: /(?:ioutil\.ReadFile|os\.ReadFile|os\.Open(?:File)?)\s*\([^)]*(?:\+\s*\w+\s*\)|r\.URL\.Query|r\.FormValue|mux\.Vars)/,
|
|
3068
|
+
severity: "high",
|
|
3069
|
+
category: "security",
|
|
3070
|
+
confidence: "medium",
|
|
3071
|
+
languages: [".go"]
|
|
3072
|
+
},
|
|
3037
3073
|
{
|
|
3038
3074
|
id: "cp-sec-open-redirect",
|
|
3039
3075
|
title: "Potential open redirect",
|
|
@@ -5479,6 +5515,7 @@ function scanFile(relPath, content, rules, changedRanges) {
|
|
|
5479
5515
|
if (!rule.multilinePattern) continue;
|
|
5480
5516
|
if (rule.id === "cp-clean-callback-hell" && isTestFile(relPath)) continue;
|
|
5481
5517
|
if (rule.id === "cp-sec-command-injection" && isScriptDir(relPath)) continue;
|
|
5518
|
+
if (rule.id === "cp-hack-wormhole-unchecked-signature-set" && /\b(?:EIP712|DOMAIN_SEPARATOR|_hashTypedDataV4|PERMIT_TYPEHASH|DELEGATION_TYPEHASH|ERC1271|EIP712Upgradeable)\b/.test(content)) continue;
|
|
5482
5519
|
rule.multilinePattern.lastIndex = 0;
|
|
5483
5520
|
const isGlobal = rule.multilinePattern.flags.includes("g");
|
|
5484
5521
|
let match;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elytrasec/engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Core analysis engine for Elytra \u2014 173 detection rules including 12 famous-hack patterns and 11 rug-surface checks, static + AI scanning, scoring.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ElytraSec <hello@elytrasec.io>",
|