Back to skill

Security audit

Task 2 Refactor - Evomap Asset

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a small bilingual C refactoring/benchmark skill with no hidden network, credential, or persistence behavior, though its C benchmark needs safer input limits.

Install only if you want a bilingual refactoring/demo skill for C configuration patterns. If you run the bundled benchmark, use modest values for --fields, --records, and --repetitions, and consider adding input validation and allocation checks before using it in automation or shared environments.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
code.c:100
Finding
Unvalidated Numeric Arguments Enable Memory Corruption and Resource Exhaustion<![CDATA[ ## Vulnerability Details **File Location**: `code.c`, lines 100–111 and 207–223 **Vulnerability Type**: Unchecked numeric conversion, integer overflow, unchecked memory allocation, and unbounded resource consumption **Risk Level**: Medium ### Vulnerable Code ```c // Store results double **results = malloc(num_methods * sizeof(double*)); for (int i = 0; i < num_methods; i++) { results[i] = malloc(repetitions * sizeof(double)); } // Randomize test order srand(42); int total_tests = num_methods * repetitions; int *test_sequence = malloc(total_tests * sizeof(int)); for (int i = 0; i < num_methods; i++) { for (int j = 0; j < repetitions; j++) { test_sequence[i * repetitions + j] = i; } } ``` The affected dimensions originate directly from command-line arguments: ```c int main(int argc, char *argv[]) { int num_fields = DEFAULT_FIELDS; int num_records = DEFAULT_RECORDS; int repetitions = DEFAULT_REPETITIONS; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "--fields") == 0 && i + 1 < argc) { num_fields = atoi(argv[++i]); } else if (strcmp(argv[i], "--records") == 0 && i + 1 < argc) { num_records = atoi(argv[++i]); } else if (strcmp(argv[i], "--repetitions") == 0 && i + 1 < argc) { repetitions = atoi(argv[++i]); } } printf("代码重构效率基准测试\n"); run_experiment(num_fields, num_records, repetitions); ``` ### Technical Analysis The program converts attacker-controlled arguments with `atoi()`. This function cannot distinguish a valid zero from malformed input and provides no reliable overflow or range-error reporting. The resulting signed integers are passed directly to loop bounds, allocation-size calculations, and arithmetic. The `repetitions` value is particularly dangerous: 1. `repetitions * sizeof(double)` is converted to the unsigned allocation type. A negative value can therefore become an extremely large requested allocation. ...[truncated 2726 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `atoi()` with `strtol()` or `strtoul()` and validate the complete input: - Reset and inspect `errno`. - Reject empty values and trailing non-numeric characters. - Reject zero and negative values where they are invalid. - Reject values outside the destination type's range. 2. Apply explicit operational limits, for example: - Maximum field count. - Maximum record count. - Maximum repetition count. These limits should reflect the expected runtime and memory budget. 3. Use `size_t` for element counts and allocation sizes rather than signed `int`. 4. Check every multiplication before allocating: ```c if (repetitions > SIZE_MAX / sizeof(double)) { fprintf(stderr, "Repetition count is too large\n"); return; } ``` 5. Check compound count calculations before use: ```c if (repetitions > SIZE_MAX / (size_t)num_methods) { fprintf(stderr, "Test count overflow\n"); return; } size_t total_tests = (size_t)num_methods * repetitions; ``` 6. Verify every allocation before dereferencing it. On failure, release all allocations already made and return an error: ```c double **results = calloc((size_t)num_methods, sizeof(*results)); if (results == NULL) { perror("calloc"); return; } ``` 7. Prevent invalid statistical operations by requiring `repetitions > 0` before starting the experiment. 8. Return a nonzero exit status when validation or allocation fails so that calling automation can reliably detect the failure. 9. Consider applying process-level CPU and memory limits when the benchmark can be invoked by untrusted users. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The title and content indicate the skill is presented in Chinese alongside English, and the skill name explicitly brands it as a Chinese-language tool. There is no statement that the user can choose their preferred language or locale, which can violate language/locale policy when a skill implicitly enforces one language without opt-in.

Vague Triggers

Medium
Confidence
90% confidence
Finding
This manifest file defines triggers such as "Hard-coded config values" and "Multi-environment deployment" without specifying exact invocation boundaries, exclusions, or negative examples. These phrases are broad enough to match many ordinary development contexts, increasing the risk of unintended skill activation.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
This code contains natural-language comments and runtime messages entirely in Chinese, including the benchmark title and progress/results output. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation when no alternative or justification is provided.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
The file includes Chinese trigger phrases and a Chinese summary alongside English content, but does not explain language selection or offer any user choice. This can violate language/locale policy expectations when a skill implicitly assumes or forces multilingual behavior without opt-in.

Static analysis

No suspicious patterns detected.