cisco-ai-skill-scanner 1.0.1__py3-none-any.whl → 1.0.2__py3-none-any.whl

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 (43) hide show
  1. {cisco_ai_skill_scanner-1.0.1.dist-info → cisco_ai_skill_scanner-1.0.2.dist-info}/METADATA +16 -1
  2. {cisco_ai_skill_scanner-1.0.1.dist-info → cisco_ai_skill_scanner-1.0.2.dist-info}/RECORD +37 -35
  3. skill_scanner/_version.py +2 -2
  4. skill_scanner/api/api_cli.py +2 -2
  5. skill_scanner/api/api_server.py +1 -1
  6. skill_scanner/cli/cli.py +60 -2
  7. skill_scanner/config/yara_modes.py +314 -0
  8. skill_scanner/core/analyzers/llm_analyzer.py +3 -3
  9. skill_scanner/core/analyzers/meta_analyzer.py +50 -18
  10. skill_scanner/core/analyzers/static.py +177 -27
  11. skill_scanner/core/models.py +1 -0
  12. skill_scanner/core/reporters/markdown_reporter.py +9 -3
  13. skill_scanner/core/static_analysis/context_extractor.py +87 -13
  14. skill_scanner/data/prompts/code_alignment_threat_analysis_prompt.md +103 -28
  15. skill_scanner/data/prompts/llm_response_schema.json +3 -3
  16. skill_scanner/data/prompts/skill_meta_analysis_prompt.md +10 -9
  17. skill_scanner/data/prompts/skill_threat_analysis_prompt.md +42 -6
  18. skill_scanner/data/rules/signatures.yaml +141 -35
  19. skill_scanner/data/yara_rules/autonomy_abuse_generic.yara +66 -0
  20. skill_scanner/data/yara_rules/{skill_discovery_abuse.yara → capability_inflation_generic.yara} +7 -4
  21. skill_scanner/data/yara_rules/code_execution_generic.yara +76 -0
  22. skill_scanner/data/yara_rules/{coercive_injection.yara → coercive_injection_generic.yara} +2 -2
  23. skill_scanner/data/yara_rules/command_injection_generic.yara +77 -0
  24. skill_scanner/data/yara_rules/{credential_harvesting.yara → credential_harvesting_generic.yara} +25 -4
  25. skill_scanner/data/yara_rules/{transitive_trust_abuse.yara → indirect_prompt_injection_generic.yara} +8 -5
  26. skill_scanner/data/yara_rules/{prompt_injection.yara → prompt_injection_generic.yara} +2 -2
  27. skill_scanner/data/yara_rules/{unicode_steganography.yara → prompt_injection_unicode_steganography.yara} +23 -17
  28. skill_scanner/data/yara_rules/script_injection_generic.yara +82 -0
  29. skill_scanner/data/yara_rules/{sql_injection.yara → sql_injection_generic.yara} +22 -8
  30. skill_scanner/data/yara_rules/system_manipulation_generic.yara +79 -0
  31. skill_scanner/data/yara_rules/tool_chaining_abuse_generic.yara +72 -0
  32. skill_scanner/threats/__init__.py +24 -2
  33. skill_scanner/threats/cisco_ai_taxonomy.py +274 -0
  34. skill_scanner/threats/threats.py +28 -99
  35. skill_scanner/data/yara_rules/autonomy_abuse.yara +0 -66
  36. skill_scanner/data/yara_rules/code_execution.yara +0 -61
  37. skill_scanner/data/yara_rules/command_injection.yara +0 -54
  38. skill_scanner/data/yara_rules/script_injection.yara +0 -83
  39. skill_scanner/data/yara_rules/system_manipulation.yara +0 -65
  40. skill_scanner/data/yara_rules/tool_chaining_abuse.yara +0 -60
  41. {cisco_ai_skill_scanner-1.0.1.dist-info → cisco_ai_skill_scanner-1.0.2.dist-info}/WHEEL +0 -0
  42. {cisco_ai_skill_scanner-1.0.1.dist-info → cisco_ai_skill_scanner-1.0.2.dist-info}/entry_points.txt +0 -0
  43. {cisco_ai_skill_scanner-1.0.1.dist-info → cisco_ai_skill_scanner-1.0.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,66 +0,0 @@
1
- //////////////////////////////////////////
2
- // Unbounded Autonomy Detection
3
- // Target: Instructions that give skills excessive autonomy
4
- // For agent skills with dangerous autonomous behaviors
5
- //////////////////////////////////////////
6
-
7
- rule autonomy_abuse{
8
-
9
- meta:
10
- author = "Cisco"
11
- description = "Detects unbounded autonomy patterns that could lead to runaway behavior"
12
- classification = "harmful"
13
- threat_type = "AUTONOMY ABUSE"
14
-
15
- strings:
16
-
17
- // Keep trying without limits
18
- $keep_trying = /\b(keep (trying|attempting|retrying)|retry (until|till) (it )?(works?|succeeds?)|don't (give up|stop) until|continue (until|till) (success|it works))\b/i
19
-
20
- // Run without confirmation
21
- $no_confirmation = /\b(run without (asking|confirmation|permission|approval)|don't (ask|confirm|wait for) (user|permission|approval)|proceed without (asking|confirmation|permission))\b/i
22
-
23
- // Automatic execution
24
- $auto_execute = /\b(automatically (execute|run|perform|do)|auto-?(run|execute|perform)|execute (immediately|automatically|right away))\b/i
25
-
26
- // Unbounded loops (simplified regex for YARA compatibility)
27
- $unbounded_loops = /\b(run (continuously|forever|indefinitely)|keep (running|going) (forever|indefinitely)|while True:)\b/i
28
-
29
- // Ignore errors and continue
30
- $ignore_errors = /\b(ignore (all |any )?(errors?|exceptions?|failures?)|suppress (all |any )?(errors?|exceptions?)|continue (on|despite|after) (error|exception|failure))\b/i
31
-
32
- // Escalating behavior
33
- $escalating = /\b(if (that |this )?fails?,? (try|attempt|use) (more|higher|elevated) (privileges?|permissions?|access)|escalate (to|until))\b/i
34
-
35
- // Self-modification
36
- $self_modify = /\b(modify (itself|yourself|own|this skill)|update (itself|yourself|own|this skill)|change (own|this skill's) (code|behavior|instructions?))\b/i
37
-
38
- // Autonomous decision making without bounds
39
- $autonomous_decisions = /\b(decide (what|which|how) to (do|run|execute) (next|automatically)|choose (your own|automatically) (next )?actions?)\b/i
40
-
41
- condition:
42
-
43
- // Keep trying patterns
44
- $keep_trying or
45
-
46
- // No confirmation
47
- $no_confirmation or
48
-
49
- // Auto execution
50
- $auto_execute or
51
-
52
- // Unbounded loops
53
- $unbounded_loops or
54
-
55
- // Ignore errors
56
- $ignore_errors or
57
-
58
- // Escalating behavior
59
- $escalating or
60
-
61
- // Self-modification
62
- $self_modify or
63
-
64
- // Autonomous decisions
65
- $autonomous_decisions
66
- }
@@ -1,61 +0,0 @@
1
- //////////////////////////////////////////
2
- // Code Execution Detection Rule for Agent Skills
3
- // Target: Python and Bash execution patterns
4
- // (eval, exec, subprocess, shell injection)
5
- /////////////////////////////////////////
6
-
7
- rule code_execution{
8
-
9
- meta:
10
-
11
- author = "Cisco"
12
- description = "Detects dangerous code execution patterns in agent skills (Python/Bash)"
13
- classification = "harmful"
14
- threat_type = "CODE EXECUTION"
15
-
16
- strings:
17
-
18
- // Python dangerous execution (eval, exec with actual content)
19
- $python_eval_exec = /\b(eval|exec)\s*\([^)]{5,}\)/i
20
-
21
- // Python system/subprocess execution
22
- $python_system_calls = /\b(os\.(system|popen|execv?p?e?|spawnv?p?e?)|subprocess\.(run|call|Popen|check_output))\s*\(/i
23
-
24
- // Python __import__ with user input
25
- $python_import_abuse = /\b__import__\s*\([^)]*input/i
26
-
27
- // Bash shell execution with variables
28
- $bash_shell_exec = /\b(system|exec|popen|spawn)\s*\([^)]*[\$\{]/i
29
-
30
- // Base64 decode followed by exec/eval (obfuscation)
31
- $obfuscated_execution = /\b(base64\.b64decode|decode\(|atob)\s*\([^)]+\)[\s\n]*.*\b(eval|exec|os\.system|subprocess)\s*\(/i
32
-
33
- // Shell command injection patterns
34
- $shell_injection = /[\"|\']\s*[;&|]\s*(rm|wget|curl|nc|bash|sh|python)\s+/
35
-
36
- // Pickle deserialization (unsafe)
37
- $unsafe_deserialize = /\bpickle\.(loads?|load)\s*\(/i
38
-
39
- condition:
40
-
41
- // Python eval/exec with content
42
- $python_eval_exec or
43
-
44
- // Python system calls
45
- $python_system_calls or
46
-
47
- // Python import abuse
48
- $python_import_abuse or
49
-
50
- // Bash shell execution
51
- $bash_shell_exec or
52
-
53
- // Obfuscated execution
54
- $obfuscated_execution or
55
-
56
- // Shell injection
57
- $shell_injection or
58
-
59
- // Unsafe deserialization
60
- $unsafe_deserialize
61
- }
@@ -1,54 +0,0 @@
1
- //////////////////////////////////////////
2
- // Shell/System Command Injection Detection Rule
3
- // Target: Command injection patterns for agent skills (Python/Bash)
4
- // (Shell operators, dangerous commands, network tools + reverse shells)
5
- /////////////////////////////////////////
6
-
7
- rule command_injection{
8
-
9
- meta:
10
- author = "Cisco"
11
- description = "Detects command injection patterns in agent skills: shell operators, system commands, and network tools"
12
- classification = "harmful"
13
- threat_type = "INJECTION ATTACK"
14
-
15
- strings:
16
-
17
- // Dangerous system commands
18
- $dangerous_system_cmds = /\b(shutdown|reboot|halt|poweroff)\s+(-[fh]|now|0)\b/
19
-
20
- // Network tools with suspicious usage (reverse connections, port scanning)
21
- $malicious_network_tools = /\b(nc|netcat)\s+(-[le]|25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/i
22
-
23
- // Reconnaissance tools
24
- $reconnaissance_tools = /\b(nmap)\s+(-[sS]|--script|25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/i
25
-
26
- // Data exfiltration with curl/wget to external URLs
27
- $data_exfiltration_tools = /\b(wget|curl)\s+(http[s]?:\/\/[^\s]+|ftp:\/\/[^\s]+|-[oO]\s|--output\s)/i
28
-
29
- // Reverse shell patterns (high severity)
30
- $reverse_shells = /\b(bash\s+-i|sh\s+-i|nc\s+-e|\/dev\/tcp\/[0-9]+\.|socat.*exec|python.*socket.*connect)\b/i
31
-
32
- // Shell command chaining with suspicious patterns
33
- $shell_chaining = /[|&;]\s*(rm\s+-rf|dd\s+if=|chmod\s+777|wget\s+http|curl\s+http)/
34
-
35
- condition:
36
-
37
- // Dangerous system command patterns
38
- $dangerous_system_cmds or
39
-
40
- // Network tool abuse patterns
41
- $malicious_network_tools or
42
-
43
- // Reconnaissance tools
44
- $reconnaissance_tools or
45
-
46
- // Data exfiltration tools
47
- $data_exfiltration_tools or
48
-
49
- // Reverse shell patterns
50
- $reverse_shells or
51
-
52
- // Shell command chaining
53
- $shell_chaining
54
- }
@@ -1,83 +0,0 @@
1
- //////////////////////////////////////////
2
- // Detects common scripting payloads (JS, VBScript, etc.) embeddings.
3
- // Target: JavaScript, VBScript, or ActiveX payloads.
4
- // (Event handlers or inline scripts)
5
- //////////////////////////////////////////
6
-
7
- rule script_injection{
8
-
9
- meta:
10
- author = "Cisco"
11
- description = "Detects embedded scripting payloads (JS, VBScript, etc.) in MCP tool descriptions"
12
- classification = "harmful"
13
- threat_type = "INJECTION ATTACK"
14
-
15
- strings:
16
-
17
- // Script tags and protocol handlers (exclude XML namespaces)
18
- $tags = /(<\/?script[^>]*>|javascript:)/i
19
-
20
- // ALWAYS exclude (safe in all file types)
21
- $xml_namespace = /(xmlns:script=|<script:module|<script:)/
22
- $openoffice_xml = /openoffice\.org\/2000\/script/
23
- $legitimate_cdn = /(cdnjs\.cloudflare\.com|cdn\.jsdelivr\.net|unpkg\.com)/i
24
-
25
- // Only exclude in MARKDOWN files (risky in .py files!)
26
- // Check for markdown-specific syntax
27
- $markdown_heading = /^#\s+/
28
- $markdown_list = /^\*\s+/
29
- $markdown_code_block = /(```html|```javascript|```js)/i
30
- $documentation_context = /(example.*html|artifact.*structure|template|single.*file)/i
31
-
32
- // Execution functions
33
- $execution_functions = /\b(setTimeout|Function|setInterval)\s*\(/i
34
-
35
- // VBScript execution and Windows Script Host objects
36
- $vbs_execution = /\b(vbscript|CreateObject|WScript\.Shell|Shell\.Application)\b/i
37
-
38
- // VBScript dangerous functions (more specific to avoid false positives in docs)
39
- $vbs_dangerous_functions = /\b(WScript\.Shell\.Exec|Shell\.Application\.ShellExecute|CreateObject.*Exec)\s*\(/i
40
-
41
- // Base64 encoded script data URIs
42
- $encoded_script_uris = /\bdata:(text\/html|application\/javascript);base64\b/i
43
-
44
- // ANSI terminal deception patterns
45
- $ansi_deception = /(\\x1[Bb]\[38;5;\d+|\\x1[Bb]\[2F\\x1[Bb]\[1G|\\x1[Bb]\[1;1H\\x1[Bb]\[0J|\\x1[Bb]\]8;;.*\\x1[Bb]\\|\\033\[[0-9;]*m|\\e\[[0-9;]*[mGKHF])/i
46
-
47
- // Hidden instruction obfuscation
48
- $hidden_obfuscation = /\b(padding.*push.*off.*screen|hidden.*scrollbar|overflow.*hidden.*instruction|invisible.*text.*color)\b/i
49
-
50
- condition:
51
-
52
- // ALWAYS exclude (safe everywhere)
53
- not $xml_namespace and
54
- not $openoffice_xml and
55
- not $legitimate_cdn and
56
-
57
- // Only exclude markdown patterns if file has markdown indicators
58
- not (($markdown_heading or $markdown_list) and ($markdown_code_block or $documentation_context)) and
59
-
60
- (
61
- // Script tags and protocol handlers
62
- $tags or
63
-
64
- // Execution functions
65
- $execution_functions or
66
-
67
- // VBScript execution
68
- $vbs_execution or
69
-
70
- // VBScript dangerous functions
71
- $vbs_dangerous_functions or
72
-
73
- // Base64 encoded script URIs
74
- $encoded_script_uris or
75
-
76
- // ANSI terminal deception
77
- $ansi_deception or
78
-
79
- // Hidden instruction obfuscation
80
- $hidden_obfuscation
81
- )
82
-
83
- }
@@ -1,65 +0,0 @@
1
- //////////////////////////////////////////
2
- // System Manipulation and Privilege Escalation Detection
3
- // Target: File destruction and manipulation operations
4
- // (Process control and termination)
5
- //////////////////////////////////////////
6
-
7
- rule system_manipulation{
8
-
9
- meta:
10
- author = "Cisco"
11
- description = "Detects system manipulation, privilege escalation, and destructive file operations"
12
- classification = "harmful"
13
- threat_type = "SYSTEM MANIPULATION"
14
-
15
- strings:
16
- // Suspicious environment variable manipulation (not just reading)
17
- $env_var_manipulation = /\b(os\.environ\s*\[[^\]]*\]\s*=|export\s+PATH=|unset\s+(PATH|HOME|USER))\b/i
18
-
19
- // File destruction and manipulation
20
- $file_destruction = /\b(rm\s+-rf|dd\s+if=\/dev\/zero|wipefs|shred\s+-|find\s+[^\n]+-delete)\b/i
21
-
22
- // Dangerous file permission changes
23
- $permission_manipulation = /\b(chmod\s+(777|4755|6755|[ug]?\+s)|(chown|chgrp)\s+(root|0)|setuid|setgid)\b/i
24
-
25
- // Critical system file access
26
- $critical_system_access = /\b(\/etc\/(passwd|shadow|sudoers)|\/root\/\.ssh|~\/\.aws\/credentials|~\/\.ssh\/id_rsa)\b/i
27
-
28
- // Privilege escalation patterns
29
- $privilege_escalation = /\b(sudo\s+-[si]|su\s+-c?|runuser|doas)\b/i
30
-
31
- // Dangerous process operations
32
- $process_manipulation = /\b(kill\s+-9\s+[0-9]+|killall\s+-9|pkill\s+-9)\b/i
33
-
34
- // Dangerous recursive operations with wildcards
35
- $recursive_operations = /\b(rm\s+-rf\s+[\$\/\*]|find\s+\/\s+-delete)\b/i
36
-
37
- // System path manipulation
38
- $path_manipulation = /\b(PATH=\/tmp|PATH=\.:|export\s+PATH=[\$\{])/i
39
-
40
- condition:
41
-
42
- // Environment variable manipulation (not just reading)
43
- $env_var_manipulation or
44
-
45
- // File destruction
46
- $file_destruction or
47
-
48
- // Permission manipulation
49
- $permission_manipulation or
50
-
51
- // Critical system access
52
- $critical_system_access or
53
-
54
- // Privilege escalation
55
- $privilege_escalation or
56
-
57
- // Process manipulation
58
- $process_manipulation or
59
-
60
- // Recursive operations
61
- $recursive_operations or
62
-
63
- // PATH manipulation
64
- $path_manipulation
65
- }
@@ -1,60 +0,0 @@
1
- //////////////////////////////////////////
2
- // Tool Chaining Abuse Detection
3
- // Target: Suspicious multi-step operations that could exfiltrate data
4
- // For agent skills that chain operations suspiciously
5
- //////////////////////////////////////////
6
-
7
- rule tool_chaining_abuse{
8
-
9
- meta:
10
- author = "Cisco"
11
- description = "Detects suspicious tool chaining patterns that could lead to data exfiltration"
12
- classification = "harmful"
13
- threat_type = "TOOL CHAINING ABUSE"
14
-
15
- strings:
16
-
17
- // Read → Send pattern
18
- $read_then_send = /\b(read|fetch|get|retrieve|collect|gather)\b[^\n]{0,100}\b(send|post|upload|transmit|forward|email|slack|webhook)\b/i
19
-
20
- // Collect → Exfiltrate pattern
21
- $collect_exfiltrate = /\b(collect (all |every |entire )?(data|files?|info|credentials?|secrets?|keys?|tokens?))\b[^\n]{0,150}\b(send|post|upload|transmit|curl|wget|requests\.post)\b/i
22
-
23
- // Multi-step with network
24
- $multistep_network = /\b(first|then|next|after|finally),? (read|collect|gather)\b[^\n]{0,100}\b(then|next|after|finally),? (send|post|upload)\b/i
25
-
26
- // Summarize and send externally
27
- $summarize_send = /\b(summarize|aggregate|compile)\b[^\n]{0,80}\b(send|post|email|slack) (to|via) (external|webhook|url|endpoint|api)\b/i
28
-
29
- // Read environment → Network
30
- $env_to_network = /\b(os\.environ|getenv|process\.env)\b[^\n]{0,150}\b(requests\.|urllib\.|curl|wget|socket\.)\b/i
31
-
32
- // File traversal → Collection → Send
33
- $traverse_collect_send = /\b(walk|rglob|listdir|scandir|find)\b[^\n]{0,100}\b(open|read)\b[^\n]{0,100}\b(send|post|upload)\b/i
34
-
35
- // Automated data pipeline
36
- $auto_pipeline = /\b(automatically (read|collect|gather))\b[^\n]{0,100}\b(and |then )?(send|post|forward|upload)\b/i
37
-
38
- condition:
39
-
40
- // Read then send
41
- $read_then_send or
42
-
43
- // Collect and exfiltrate
44
- $collect_exfiltrate or
45
-
46
- // Multi-step with network
47
- $multistep_network or
48
-
49
- // Summarize and send
50
- $summarize_send or
51
-
52
- // Environment to network
53
- $env_to_network or
54
-
55
- // Traverse, collect, send
56
- $traverse_collect_send or
57
-
58
- // Automated pipeline
59
- $auto_pipeline
60
- }