Back to skill

Security audit

Agent Security Skill Scanner Gitee

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent security scanner, but its install and persistence guidance contains unsafe or inconsistent commands that need manual review.

Review before installing. Prefer a local clone from a verified repository and a Python virtual environment; do not use the pending global npm asc-scan command unless the namespace is verified. Do not run the publish checklist cleanup or force-push commands in a working repository, and do not use crontab -r to remove this scanner because it can delete unrelated scheduled jobs. Use only test or scoped API keys for optional LLM or alert integrations.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unsafe and Inconsistent Package Installation Instructions

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-2, README.md:18-20, SKILL.md:86-89, package.json:2
Vulnerability Type: Dependency confusion and installation of an unverified package namespace
Risk Level: Medium

Vulnerable Code

requirements.txt:1-2:

text
# Core Dependencies
python>=3.8

README.md:18-20:

bash
git clone https://github.com/agent-security/scanner.git
cd scanner
pip install -r requirements.txt

SKILL.md:86-89:

bash
npm install -g asc-scan

package.json:2:

json
"name": "agent-security-scanner",

Technical Analysis

python>=3.8 is placed in requirements.txt as though the Python interpreter were an installable PyPI dependency. Python dependency files are intended to list distribution packages, not interpreter-version constraints. A package manager can therefore attempt to resolve and install a third-party distribution named python, which is unrelated to enforcing the required interpreter version.

The npm installation documentation also instructs users to globally install asc-scan, while the supplied package metadata declares the package name as agent-security-scanner. The documentation states that npm publication is pending, and the audited artifact provides no evidence that the asc-scan namespace is controlled by this project.

These inconsistencies create a supply-chain exposure: users may retrieve code from an unintended package namespace rather than installing the audited project.

Attack Path

  1. An attacker publishes, controls, or compromises the package namespace referenced by the documentation, such as asc-scan or the unintended PyPI distribution python.
  2. A user follows the project's documented installation procedure.
  3. The package manager resolves the external package from the public registry.
  4. Package installation or lifecycle code executes under the privileges of the in ...[truncated 1234 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove python>=3.8 from requirements.txt.
  2. Enforce the interpreter version through appropriate packaging metadata, such as:
    toml
    [project]
    requires-python = ">=3.8"
    
  3. Use one consistent and verified npm package name across package.json, SKILL.md, and all installation documentation.
  4. Remove npm installation instructions until the package has been published under a namespace demonstrably controlled by the project.
  5. Pin release versions in installation examples rather than installing an unspecified latest version.
  6. Publish package checksums, signed release artifacts, and registry provenance information.
  7. Test installation in a clean virtual environment and CI environment to verify that no unrelated distributions are downloaded.
  8. Advise users not to install with elevated privileges and to use isolated Python virtual environments and an npm prefix owned by the user.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:183
Finding

Destructive Cron Cleanup Instruction Removes Unrelated Scheduled Tasks

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:183-194
Vulnerability Type: Unsafe destructive system-administration guidance
Risk Level: Medium

Vulnerable Code

SKILL.md:183-189:

bash
crontab -e
0 * * * * python3 /path/to/scanner.py

SKILL.md:194:

bash
crontab -r

Technical Analysis

The documented cron task is optional, manually configured, and consistent with periodic security scanning. The audited executable code does not automatically install a cron task or service. Therefore, the presence of these instructions does not constitute covert system persistence.

However, the documented cleanup command crontab -r removes the invoking user's entire crontab. It does not selectively remove the scanner entry. The command can consequently delete unrelated backup, monitoring, certificate-renewal, synchronization, and maintenance jobs.

The example also refers to /path/to/scanner.py, but no file with that name appears in the supplied artifact. This increases the likelihood of configuration errors and makes the documented lifecycle incomplete.

Attack Path

  1. A user follows the documentation and adds the periodic scanner command to an existing crontab.
  2. The same crontab already contains unrelated operational jobs.
  3. The user later attempts to uninstall or disable the scanner.
  4. The user follows the documented crontab -r cleanup instruction.
  5. Cron removes every scheduled task belonging to that user without restricting deletion to the scanner entry.
  6. Unrelated scheduled operations silently stop running.

No elevated privileges are required to damage the current user's scheduled tasks. If the instruction is run while operating as root, all root-owned cron entries managed through that crontab can be removed.

Impact Assessment

The direct impact is loss of scheduled-task configuration for the invoking account. Depending on the affected jobs, consequence ...[truncated 498 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the recommendation to use crontab -r.
  2. Add a unique marker to the scanner entry:
    cron
    0 * * * * python3 /verified/path/to/scanner_cli.py scan /target # agent-security-scanner
    
  3. Instruct users to remove only the marked line with crontab -e.
  4. If scripted removal is provided, back up and filter the existing crontab safely:
    bash
    crontab -l > "$HOME/crontab.backup"
    crontab -l | grep -v '# agent-security-scanner' | crontab -
    
  5. Handle the case where no crontab exists and require user confirmation before replacing it.
  6. Reference an executable that is actually included in the released artifact.
  7. Document installation, status inspection, log location, disabling, and selective removal procedures.
  8. Keep recurring execution disabled by default and require explicit user consent, as the existing documentation otherwise intends.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (93)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The command rm -rf logs/ config/ metrics/ is a destructive filesystem operation that assumes correct working directory and intended targets. In an agent-operated or copy-paste workflow, misuse can delete important local data or environment-specific configuration with no recovery path.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 91)May include surrounding context.

bash
# 删除不应发布的目录
rm -rf logs/ config/ metrics/
rm -rf samples/ data/ expert_mode/ scripts/
rm -rf round*/ reports/temp/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The command rm -rf samples/ data/ expert_mode/ scripts/ recursively deletes several top-level directories and could remove valuable or unintended content if run from the wrong location. The use of generic names like data/ and scripts/ makes accidental overreach more plausible in real environments.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 92)May include surrounding context.

bash
# 删除不应发布的目录
rm -rf logs/ config/ metrics/
rm -rf samples/ data/ expert_mode/ scripts/
rm -rf round*/ reports/temp/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The globbed deletion rm -rf round*/ reports/temp/ is especially risky because wildcard expansion can match more paths than expected and deletes them recursively without confirmation. In an automated or agent setting, this can remove unrelated directories that happen to share the prefix.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 93)May include surrounding context.

删除不应发布的目录

rm -rf logs/ config/ metrics/ rm -rf samples/ data/ expert_mode/ scripts/ rm -rf round*/ reports/temp/

text

### 3. 验证阶段

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

The documented git push ... --force commands rewrite remote history and can permanently discard commits for collaborators or downstream users if used on the wrong branch or repository. In an agent skill, publishing these as routine steps without approval gates or warnings is dangerous because automated workflows may execute them blindly.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 117)May include surrounding context.

  • 只保留必要的开源文件"

推送到对外仓库

git push origin master --force git push github master --force

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

This cleanup script line repeats recursive deletion of multiple directories with no safety checks. As embedded operational guidance, it creates a high risk of accidental destructive execution when reused outside the narrowly intended repository context.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 217)May include surrounding context.

md
echo "清理研发过程文件..."

rm -rf samples/ data/ expert_mode/ scripts/
rm -rf logs/ config/ metrics/
rm -rf round*/ reports/temp/
rm -rf __pycache__/ *.pyc

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

This line deletes logs/ config/ metrics/ recursively inside a reusable script, again without any guardrails. Configuration directories are particularly sensitive because deleting them can break environments or erase secrets-management pointers and runtime settings.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 218)May include surrounding context.

md
echo "清理研发过程文件..."

rm -rf samples/ data/ expert_mode/ scripts/
rm -rf logs/ config/ metrics/
rm -rf round*/ reports/temp/
rm -rf __pycache__/ *.pyc
rm -rf .idea/ .vscode/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The wildcard deletion rm -rf round*/ reports/temp/ in script form can erase multiple matching directories non-interactively. Wildcards combined with recursion are hazardous in agent or automated contexts because they can expand unpredictably based on local filesystem state.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 219)May include surrounding context.

md
rm -rf samples/ data/ expert_mode/ scripts/
rm -rf logs/ config/ metrics/
rm -rf round*/ reports/temp/
rm -rf __pycache__/ *.pyc
rm -rf .idea/ .vscode/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

Deleting __pycache__/ and *.pyc is usually low-risk housekeeping, but the use of recursive force deletion and shell globbing in a generic script still introduces unnecessary destructive behavior. In the wrong directory, it could remove compiled artifacts outside the intended repository tree.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 220)May include surrounding context.

md
rm -rf samples/ data/ expert_mode/ scripts/
rm -rf logs/ config/ metrics/
rm -rf round*/ reports/temp/
rm -rf __pycache__/ *.pyc
rm -rf .idea/ .vscode/

echo "✅ 清理完成"

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
92% confidence
Finding

Removing .idea/ and .vscode/ is less severe than deleting source or data, but it still destroys user-specific workspace configuration without warning. In shared or local development environments, that can cause avoidable loss of developer settings and context.

Content

Scanner excerpt · PUBLISH_CHECKLIST.md (reported line 221)May include surrounding context.

md
rm -rf logs/ config/ metrics/
rm -rf round*/ reports/temp/
rm -rf __pycache__/ *.pyc
rm -rf .idea/ .vscode/

echo "✅ 清理完成"
git status

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description says this skill is an AI agent security scanner for malicious code detection with multilingual support and CLI usage. However, the supplied code chunk is not a scanner implementation at all; it is a pre-release validator for the package. Its primary function is to verify that expected files exist, that a scanner module can be imported, that certain feature strings appear in source code, and that benchmark metrics meet thresholds. It also generates a validation_report.json and exits success/failure for release gating. While this script is related to the broader scanner project, the behavior of this chunk materially differs from the declared purpose and includes undeclared release-audit/reporting capabilities. Therefore the description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The code does perform a form of malicious-content detection, so it partially aligns with the declared security-scanning theme. However, its primary purpose is more specific and materially different: it is a benchmark harness for evaluating YARA rules against a local malicious sample set, including throughput, p95/p99 latency, and detection-rate reporting. It is not implementing a general AI agent security scanner, and there is no evidence in this chunk of multilingual support or a real CLI interface beyond running the script directly. The code also generates benchmark reports, which is an undeclared capability relative to the description. Therefore the description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · docs/CAPABILITIES.md (reported line 113)May include surrounding context.

SENSITIVE_PATHS = [ '/etc/passwd', '/etc/shadow', '~/.ssh/id_rsa', '/proc/self/environ', ]

text

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · docs/CAPABILITIES.md (reported line 318)May include surrounding context.

~3% | 测试样本集 | | CPU 利用率 | ≤80% | ~60% | 多核并行 |


四、使用场景

4.1 技能市场审核 🔒

  • ✅ 新技能上架前安全扫描
  • ✅ 定期安全复审 (每季度)
  • ✅ 用户举报响应处理

4.2 企业 Agent 治理 🏢

  • ✅ 内部技能库安全审计
  • ✅ 供应链安全检查
  • ✅ 合规性验证 (等保/GDPR)

4.3 开发者自检 👨‍💻

  • ✅ 发布前安全自测
  • ✅ CI/CD 集成检查
  • ✅ 代码质量持续提升

五、集成方式

5.1 CLI 命令行

bash
# 单个技能扫描
python cli.py scan <skill_path>

# 批量扫描
python cli.py scan-all <skills_dir>

# JSON 格式输出
python cli.py scan <skill_path> --format json

# 详细模式
python cli.py scan <skill_path> --verbose

# 指定输出文件
python cli.py scan <skill_path> --output report.json

5.2 Python API

python
from cli import scan_skill

# 扫描技能
result = scan_skill("path/to/skill")

# 获取评分
score = resu

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · src/benchmark_full_scan.py (reported line 39)May include surrounding context.

python
rules_content = merged_rules.read_text(errors='ignore')
        rules = yara.compile(source=rules_content)
        print(f"   ✅ 加载 merged_rules.yar ({len(rules_content):,} 字节)")
        return rules
    except Exception as e:
        print(f"❌ 规则编译失败:{e}")
        return None

Obfuscated Code

High
Category
Supply Chain
Confidence
85% confidence
Finding

Code contains obfuscation (base64, hex encoding with execution). This is often used to hide malicious functionality.

Content

Scanner excerpt · src/engine/smart_pattern_detector.py (reported line 22)May include surrounding context.

python
HIGH_RISK_PATTERNS = {
        # 命令执行
        "exec(": 15, "eval(": 15, "compile(": 8,
        "__import__('os').system": 15, "__import__('subprocess'": 12,
        "subprocess.Popen(": 12, "subprocess.run(": 6, "subprocess.call(": 6,
        "shell=True": 7, "os.system(": 8, "os.popen(": 8,

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · src/engine/smart_pattern_detector.py (reported line 23)May include surrounding context.

python
# 命令执行
        "exec(": 15, "eval(": 15, "compile(": 8,
        "__import__('os').system": 15, "__import__('subprocess'": 12,
        "subprocess.Popen(": 12, "subprocess.run(": 6, "subprocess.call(": 6,
        "shell=True": 7, "os.system(": 8, "os.popen(": 8,
        
        # 权限提升

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · src/engine/smart_pattern_detector.py (reported line 23)May include surrounding context.

python
# 命令执行
        "exec(": 15, "eval(": 15, "compile(": 8,
        "__import__('os').system": 15, "__import__('subprocess'": 12,
        "subprocess.Popen(": 12, "subprocess.run(": 6, "subprocess.call(": 6,
        "shell=True": 7, "os.system(": 8, "os.popen(": 8,
        
        # 权限提升

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/engine/smart_pattern_detector.py (reported line 38)May include surrounding context.

python
"persistence": 8, "backdoor": 10,
        
        # 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/intent_detector_v2.py (reported line 81)May include surrounding context.

python
"persistence": 8, "backdoor": 10,
        
        # 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/multi_language_scanner_v4.py (reported line 369)May include surrounding context.

python
"persistence": 8, "backdoor": 10,
        
        # 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,

YARA rule 'info_stealer': Information stealer patterns (credential harvesting, browser data theft) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · src/engine/smart_pattern_detector.py (reported line 38)May include surrounding context.

python
"setgid": 10,
        "privilege": 8, "escalat": 8,
        
        # 持久化
        "crontab": 10, "/etc/cron": 10, "systemctl enable": 10, "systemctl start": 8,
        "winreg.SetValue": 12, "winreg.CreateKey": 12, "launchd.plist": 10,
        "/etc/profile.d": 10, ".bashrc": 8, "Register-ScheduledTask": 12,
        "persistence": 8, "backdoor": 10,
        
        # 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,
        
        # 网络外传
        "requests.post(": 10, "requests.get(": 5,
        "urllib.request.urlopen(": 7, "urllib.request.urlretrieve": 10,
        "socket.socket(": 8, "ftplib.FTP": 10, "smtplib.SMTP": 10,
        
        # 数据破坏 (增强)
        "shutil.rmtree(": 12, "os.remove(": 8, "os.unlink(": 8,
        "fernet.encrypt(": 10, "Remove-Item": 10,
        "data_destruction": 10, "r

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · docs/CAPABILITIES.md (reported line 112)May include surrounding context.

md
# 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,
        
        # 网络外传
        "requests.post(": 10, "requests.get(": 5,

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/engine/smart_pattern_detector.py (reported line 40)May include surrounding context.

python
# 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,
        
        # 网络外传
        "requests.post(": 10, "requests.get(": 5,

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/multi_language_scanner_v4.py (reported line 294)May include surrounding context.

python
# 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,
        
        # 网络外传
        "requests.post(": 10, "requests.get(": 5,

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/multi_language_scanner_v4.py (reported line 463)May include surrounding context.

python
# 凭据窃取
        "mimikatz": 25, "keyring.get_password": 12, "win32security.CredRead": 15,
        "getpass.getpass": 10, "AWS_SECRET": 12, "get_password": 8,
        "/etc/shadow": 15, "Get-Credential": 10,
        
        # 网络外传
        "requests.post(": 10, "requests.get(": 5,