Back to skill

Security audit

Ffi Code Review

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Rust FFI code-review checklist with reference material, not an executable or data-accessing package.

Install only if you want an agent to help review Rust FFI code. It will guide the agent to inspect local crate files and may suggest running normal Rust/FFI test tooling, but the package itself is documentation-only and does not execute code or persist changes.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • 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 (1)

YARA rule 'exploit_framework': Exploit framework components and payloads [hacktools]

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 · references/safety-patterns.md (reported line 37)May include surrounding context.

me: &str) -> Result<(), Error> { let c_name = CString::new(name)?; // SAFETY: self.ptr is valid (maintained by construction), // c_name is null-terminated and lives through this call let ret = unsafe { ffi::widget_set_name(self.ptr.as_ptr(), c_name.as_ptr()) }; if ret == 0 { Ok(()) } else { Err(Error::SetNameFailed) } } }

impl Drop for Widget { fn drop(&mut self) { // SAFETY: self.ptr was allocated by widget_create // and has not been freed (we own it) unsafe { ffi::widget_destroy(self.ptr.as_ptr()) } } }

text

### Key principles for safe wrappers:
- Capture `&` vs `&mut` accurately -- if C mutates behind a pointer, take `&mut self`
- Use Rust lifetimes to enforce C's lifetime requirements (e.g., `Device<'ctx>` borrows `Context`)
- Do not implement `Send`/`Sync` unless the C library documents thread safety
- Use `PhantomData<*const ()>` to suppress auto-`Send`/`Sync` for thread-unsafe types

## Ownership Transf