📄 security-audit-report.md
⬇ Download Raw

Third-Party Software Security Review — SCORPIOX CODE

FieldValue
SoftwareSCORPIOX CODE
TypeAI-Powered Development Tool / CLI Platform
LanguagePure C (zero external dependencies)
Audit Date2026-04-29
Codebase Commit3ad7dfcfe0c414abda526ac5c747e0e88cd592f5
ClassificationCONFIDENTIAL — For Corporate Review Only

1. Executive Summary

This report presents a comprehensive security audit of SCORPIOX CODE, an AI-powered development CLI platform written in pure C. The audit was conducted by 13 specialized automated agents covering supply chain, build provenance, network endpoints, TLS security, credentials, file I/O, buffer safety, memory safety, command injection, privilege/access control, Windows deployment, telemetry, and install script security.

Key Metrics

MetricValue
Total Lines of Code381,273
Project Code (first-party)152,747
Vendor Code (third-party)228,526
Source Files Analyzed224 (non-vendor)
Vendored Libraries2 (mbedTLS 3.6.6, yyjson 0.12.0) — both current
Total Findings286
Critical2
High18
Medium100
Low60
Info87

Overall Risk Rating: MEDIUM

The software demonstrates strong engineering practices across most security domains — particularly in buffer safety (258:1 safe-to-unsafe ratio), supply chain hygiene (zero outdated dependencies, no pre-built binaries), and build hardening (stack protector, FORTIFY_SOURCE, full RELRO, NX, CFI). The primary risk areas are:

  • Memory Safety (MEDIUM) — 2 critical use-after-free patterns in streaming parsers, 14 high-severity unchecked allocations in network code, and ~80 missing NULL checks
  • Install Script Integrity (MEDIUM) — SHA256 checksums are published but not verified during installation
  • TLS Configuration (MEDIUM) — Global TLS verification can be disabled via config; silent downgrade on CA bundle failure
  • For Windows workstation deployment (the primary corporate use case), the risk is LOW-MEDIUM — most critical findings involve Linux-only code paths (container runtime, MITM proxy, VM manager) that do not compile or ship on Windows.


    2. Deployment Scope — Windows Workstation

    2.1 Windows Binaries (Ship on Windows)

    The following binaries compile and deploy on Windows workstations:

    BinaryPurpose
    sx.exeMain TUI — terminal-based AI chat interface
    scorpiox.exeCore CLI entry point
    scorpiox-bash.exeCross-platform shell command executor
    scorpiox-busybox.exeWindows-only Unix tool manager (GNU coreutils)
    scorpiox-screenshot.exeScreen capture utility
    scorpiox-vi.exeBuilt-in text editor
    scorpiox-config.exeConfiguration management
    scorpiox-websearch.exeWeb search integration
    scorpiox-fetch.exeHTTP fetch utility
    scorpiox-renderimage.exeImage rendering/display
    scorpiox-pwsh.exePowerShell integration
    scorpiox-wsl.exeWSL2 container execution (Windows-only)

    Additional Windows binaries: sx.dll, scorpiox-sdk.exe, scorpiox-gemini.exe, scorpiox-openai.exe, scorpiox-server.exe, scorpiox-dns.exe, scorpiox-frp.exe, scorpiox-tmux.exe, scorpiox-multiplexer.exe, scorpiox-voice.exe, scorpiox-agent.exe, scorpiox-tasks.exe, scorpiox-mcp.exe, plus 20+ additional utilities (token fetchers, logging, search, email).

    Total Windows binaries: 54

    2.2 Linux-Only Binaries (NOT deployed on Windows)

    BinaryPurposeWhy Linux-Only
    scorpiox-unshareRootless container runtimeLinux namespaces (CLONE_NEWUSER)
    scorpiox-vmKVM virtual machine manager/dev/kvm, Linux KVM API
    scorpiox-initContainer initializationLinux-specific
    scorpiox-sshpassSSH password utilityUnix PTY required
    scorpiox-trafficMITM TLS proxyLinux-specific networking
    scorpiox-podmanContainer managementLinux containers
    scorpiox-docsDocumentation serverLinux-specific
    scorpiox-runtestTest runnerLinux CI
    scorpiox-executecurlCurl executorLinux sandbox
    scorpiox-cronScheduled tasksLinux cron integration
    scorpiox-whatsappWhatsApp bridgeLinux service

    2.3 Windows-Filtered Findings

    When filtering findings to Windows-deployed binaries only:

    SeverityAll PlatformsWindows Only
    Critical21
    High185
    Medium10042
    Low6028
    Total (actionable)18076

    The reduction is significant because the highest-risk components (container runtime, VM manager, MITM proxy, sshpass) are Linux-only.


    3. Changes Since Last Audit

    Previous audit: 2026-04-28 (commit f7f14b4)
    MetricPrevious (Apr 28)Current (Apr 29)Delta
    Critical52−3
    High1218+6 ⚠️
    Medium14100+86 ⚠️
    Low660+54
    Info387+84
    Total40286+246
    Lines of Code369,495381,273+11,778
    Audit Agents513+8
    Overall RiskMEDIUMMEDIUM
    Analysis: The increase in findings is primarily due to expanded audit scope (13 agents vs. 5), not degraded security. The previous audit used 5 generalized agents; the current audit uses 13 specialized agents with deeper per-domain analysis. Critical findings decreased from 5 to 2, indicating real security improvements. The 80 medium-severity "missing NULL check" findings from the memory-safety agent account for the bulk of the increase — these existed in the prior codebase but were not enumerated. Notable improvements since last audit:

    4. Supply Chain & Dependencies

    Risk: LOW
    AspectStatus
    Vendored libraries2 (mbedTLS 3.6.6 ✅, yyjson 0.12.0 ✅) — both at latest
    Pre-built binariesNone in repository ✅
    Build-time fetchingNone (no FetchContent/ExternalProject) ✅
    Package managersCMake (primary), npm (optional bridge only)
    npm dependencies2 direct, 103 transitive (bridge/ only — not part of Windows deployment)
    Key findings:

    5. Build System & Code Provenance

    Risk: LOW

    Security Hardening Flags

    FlagStatus
    -fstack-protector-strong✅ Enabled
    -D_FORTIFY_SOURCE=2✅ Enabled (Release)
    -fcf-protection✅ Enabled (GCC)
    -Wl,-z,noexecstack✅ NX stack
    -Wl,-z,relro,-z,now✅ Full RELRO
    Static linking✅ Default ON
    Strip symbols✅ Release builds

    Build-Time Code Generation

    Missing (recommended):


    6. Network Endpoints

    Risk: LOW

    The codebase contains 146 URL references in project code. All production endpoints use HTTPS.

    Endpoint Categories

    CategoryCountProtocolRisk
    First-party (*.scorpiox.net)20+HTTPSExpected
    Third-party AI APIs10+HTTPSExpected
    Hardcoded DNS resolvers (8.8.8.8, 1.1.1.1)2UDP/53Medium — bypasses org DNS
    Hardcoded public IP (token service)1TCP/9800Medium
    HTTP localhost endpoints3HTTPLow (local only)
    LAN IPs (192.168.x.x)5VariousLow — info disclosure
    No unauthorized exfiltration endpoints detected. No suspicious domains.

    7. TLS/SSL Security

    Risk: MEDIUM
    FindingSeverityDescription
    Global TLS disable via configMediumSX_TLS_VERIFY=0 disables all cert verification across 10 callsites
    Mail relay TLS downgradeMediumSilent downgrade to VERIFY_OPTIONAL on CA bundle failure
    STARTTLS vulnerable to downgradeMediumFalls back to plaintext if STARTTLS rejected
    MITM proxy disables TLSLowIntentional — proxy tool by design
    mbedTLS VERIFY_NONE (server)InfoStandard SMTP server behavior
    Positive findings:

    8. Hardcoded Credentials

    Risk: LOW No actual secret values (API keys, passwords, tokens) are hardcoded. All credential fields use empty placeholder strings populated at runtime.
    FindingSeverityDescription
    SSH user+host+port in embedded configMediumroot@192.168.1.6:22223 — infrastructure disclosure
    Public IP for token serviceMedium20.53.240.54:9800 in compiled binary
    Internal LAN host in embedded configMediumroot@192.168.1.3 + SMB share path
    Empty credential placeholders compiledLowField names visible in binary strings
    Example secret in code commentLow"mysecret" string literal in frp.h
    Podman registry with TLS verify=falseLowregistry.scorpiox.net without verification

    9. File I/O & Data Handling

    Risk: LOW-MEDIUM
    FindingSeverityDescription
    Temp file leak in emit-session forkHigh/tmp/sx_emit_XXXXXX never unlinked — leaks conversation data
    Inconsistent mkdir permissionsMediumSome dirs created 0755 instead of 0700
    sshpass password in CLI argvMediumVisible in /proc/*/cmdline (Linux-only)
    Traffic logs contain full request bodiesMediumAPI responses logged to disk (Linux-only)
    Config summary in session filesMediumSensitive config keys written to session state
    Hardcoded /tmp pathsLowNo TMPDIR respect in some paths
    Positive findings:

    10. Buffer Safety

    Risk: LOW

    The project demonstrates exemplary buffer safety discipline:

    MetricValue
    snprintf calls2,213
    strncpy calls601
    sprintf (non-vendor)1 (proven safe)
    strcpy0
    strcat11 (all Windows-only, partially bounded)
    Safe-to-unsafe ratio258:1
    gets / uncontrolled scanf0
    Findings:

    11. Memory Safety

    Risk: MEDIUM

    This is the highest-risk domain identified.

    SeverityCountCategory
    Critical2Use-after-free patterns
    High14Missing NULL checks in network/security code
    Medium80Missing malloc/calloc NULL checks (total)
    Low30Error-path memory leaks
    Info5Safe patterns noted

    Critical Findings

    CRIT-01: Use-After-Free in OpenAI WASM SSE Parser CRIT-02: vtable→free followed by data access in Provider Cleanup

    High Findings (Network Code)

    Positive findings:

    12. Command Injection

    Risk: LOW

    The codebase underwent a significant bulk migration (commit 089698f) converting most system() calls to fork()+execvp(), eliminating shell interpretation. Remaining findings:

    FindingSeverityDescriptionPlatform
    IMAGE_BASE_URL in popen()MediumEnvironment variable reaches shell via single-quoted interpolationLinux
    SCORPIOX_INDEX_URL in popen()MediumConfig value reaches shell without quotingLinux
    INIT_TOOLS env in system()LowTool names from env reach which commandLinux
    Windows system() fallbacksLow6 remaining system() calls behind #ifdef _WIN32Windows
    scorpiox-server OTPLowNetwork-reachable but has is_safe_shell_arg() sanitizationBoth
    Post-migration metrics:

    13. Privilege & Access Control

    Risk: MEDIUM
    FindingSeverityDescriptionPlatform
    Container runtime no seccompHighscorpiox-unshare containers run with full syscall surfaceLinux-only
    Hard root requirement (thunderbolt4)MediumRequires geteuid() == 0Linux-only
    Root-adaptive container runtimeMedium--privileged bypasses user namespace isolationLinux-only
    No SUID/SGID binariesInfoPositive — no setuid bits setAll
    No prctl/capset/seccompInfoNo capability dropping in containersLinux-only
    Windows impact: Minimal. The high-severity container runtime finding is Linux-only. Windows binaries do not require elevated privileges for normal operation. scorpiox-wsl.exe uses standard Windows APIs (WinInet, CreateProcess).

    14. Windows Deployment Analysis

    Risk: LOW

    Windows-Specific Security Findings

    FindingSeverityDescription
    system() fallback on WindowsMediumsx_system_safe() maps to system() on _WIN32 — no shell escape
    Windows Defender SmartScreenLowUnsigned binaries trigger SmartScreen warnings
    CreateProcess without full pathLowSome process spawning without absolute paths
    ConPTY usageInfoModern Windows pseudoconsole API used correctly
    Static MinGW linkingInfoNo DLL dependencies — self-contained deployment
    SHA256 self-update verificationInfoscorpiox-wsl.exe verifies update integrity ✅

    Windows Security Architecture


    15. Telemetry and Tracking

    Risk: LOW Verdict: No tracking by default.
    FeatureDefaultOpt-In RequiredData Collected
    Usage TrackingOFFYes (USAGE_TRACKING=1)Token counts, model name, hostname, username, project
    Session TrackingOFFYes (EMIT_SESSION_TRACKING=1)Full conversation content (messages, tool calls)
    Auto-UpdateNoneUser-initiated only
    Key findings: For corporate deployment: Ensure USAGE_TRACKING=0 and EMIT_SESSION_TRACKING=0 remain in deployed configuration.

    16. Install Script & Distribution Security

    Risk: MEDIUM
    FindingSeverityDescription
    No checksum verification at installHighSHA256 sidecar files published but install scripts don't verify them
    No code signingHighNo GPG/cosign signatures on release artifacts
    curl \bash patternMediumRemote code execution without preview
    Non-atomic installMediumPartial state possible on interrupted download
    No HSTS headersMediumFirst HTTP request vulnerable to MITM before redirect
    -ExecutionPolicy Bypass in updaterMediumWindows PowerShell policy circumvented
    System-wide install on LinuxLow/usr/local/bin with sudo
    No uninstall mechanismLowNo documented cleanup procedure
    RC file modification without backupLow.zshrc/.bash_profile modified in-place
    Unvalidated branch names in updaterLowArbitrary branch names accepted
    Positive findings:

    17. Consolidated Risk Matrix

    #AreaFindingSeverityStatusPlatformRecommendation
    1MemoryUse-after-free in WASM SSE parserCriticalOpenBothRemove dead code path or fix dereference ordering
    2Memoryvtable→free contract ambiguityCriticalOpenBothDocument contract; set p->data = NULL after vtable→free
    3InstallNo checksum verification at installHighOpenBothAdd sha256sum verification to install scripts
    4InstallNo code signingHighOpenBothImplement cosign or GPG signing
    5Memory14 unchecked allocs in network codeHighOpenBothAdd NULL checks in libsxnet/
    6PrivilegeContainer runtime no seccompHighOpenLinuxAdd default seccomp profile
    7File I/OTemp file leak (emit-session)HighOpenBothUnlink temp file in child process
    8TLSGlobal TLS disable via configMediumOpenBothRemove global disable or restrict to debug builds
    9TLSMail relay silent TLS downgradeMediumOpenLinuxFail closed on CA bundle failure
    10TLSSTARTTLS downgrade to plaintextMediumOpenLinuxEnforce STARTTLS when configured
    11CredentialInfrastructure IPs in compiled binaryMediumOpenBothMove to runtime-only config
    12NetworkHardcoded DNS resolversMediumOpenBothUse system resolver or make configurable
    13NetworkPublic IP for token serviceMediumOpenBothUse DNS hostname
    14Command InjIMAGE_BASE_URL in popen()MediumOpenLinuxUse fork()+execvp()
    15Command InjSCORPIOX_INDEX_URL in popen()MediumOpenLinuxUse fork()+execvp()
    16File I/OInconsistent mkdir 0755MediumOpenLinuxUse 0700 consistently
    17File I/Osshpass password in argvMediumOpenLinuxRemove -p option; use env var only
    18Installcurl \bash patternMediumOpenBothProvide two-step install option
    19InstallNo HSTS headersMediumOpenBothAdd Strict-Transport-Security
    20Install-ExecutionPolicy BypassMediumOpenWindowsUse signed PowerShell scripts
    21Windowssystem() fallback on WindowsMediumOpenWindowsMigrate to CreateProcess with arg vector
    22Memory80 missing NULL checksMediumOpenBothAdd systematic NULL check audit
    23PrivilegeRoot-adaptive containerMediumOpenLinuxDocument security implications
    24Bufferstrcat in Windows codeLowOpenWindowsReplace with bounded alternatives
    25NetworkHTTP localhost endpointsLowOpenBothDocument as local-only
    26TelemetryHostname + username collectedLowOpenBothDocument in privacy policy
    27File I/OHardcoded /tmp pathsLowOpenLinuxRespect TMPDIR
    28Memory30 error-path memory leaksLowOpenBothFix error-path cleanup

    18. Conclusion & Recommendations

    Overall Assessment

    SCORPIOX CODE demonstrates a mature security posture for a C-based project of this scale. The codebase shows clear evidence of ongoing security investment:

    Priority Recommendations

    Immediate (Critical/High):
  • Fix use-after-free patterns in sx_provider_openai_wasm.c and sx_provider.c
  • Add SHA256 verification to install scripts (infrastructure exists, just not wired up)
  • Implement code signing for release artifacts
  • Add NULL checks to 14 network-code allocations in libsxnet/
  • Fix temp file leak in emit_session_external()
  • Short-term (Medium):
  • Remove or restrict global TLS verification disable
  • Externalize infrastructure IPs from compiled embedded config
  • Migrate remaining 2 Linux popen() calls to fork()+execvp()
  • Add HSTS headers to distribution domains
  • Migrate Windows sx_system_safe() to CreateProcess
  • Long-term (Low):
  • Systematic NULL-check audit across all 80 sites
  • Error-path memory leak cleanup (30 sites)
  • Document privacy policy for opt-in telemetry data
  • Add seccomp profile to container runtime
  • Windows Deployment Clearance

    For Windows workstation deployment, the software presents LOW-MEDIUM risk:

    Recommendation: Approve for Windows workstation deployment with the following conditions:
  • Ensure telemetry remains disabled in corporate config
  • Monitor for code signing implementation in future releases
  • Deploy via managed software distribution (bypasses install script concerns)

  • 19. Appendix: Audit Methodology

    Agents Deployed

    #AgentScopeTechnique
    1supply-chainPackage managers, vendored libs, lock filesStatic analysis of manifests + version comparison
    2build-provenanceCMake config, compiler flags, build scriptsBuild system configuration review
    3network-endpointsURLs, IPs, ports, domains in sourceRegex + semantic analysis of all .c/.h files
    4tls-securityCertificate verification, protocols, ciphersCode path analysis of TLS callsites
    5credential-hardcodeAPI keys, passwords, tokens, secretsPattern matching + entropy analysis
    6file-ioTemp files, permissions, data at restFile operation audit across all sources
    7buffer-safetysprintf/strcpy/strcat, stack buffers, boundsFunction call census + bounds verification
    8memory-safetymalloc/free patterns, UAF, double-free, leaksAllocation tracking + lifetime analysis
    9command-injectionsystem/popen/exec, shell interpretationTaint analysis from input to shell sinks
    10privilege-accesssetuid, root checks, namespaces, IPCPrivilege escalation path analysis
    11windows-deploymentWin32 API usage, Windows-specific risksPlatform-conditional code review
    12telemetry-trackingData collection, phone-home, trackingNetwork callsite + payload analysis
    13install-scriptInstall/update scripts, distribution integrityScript review + transport security verification

    Scope & Limitations


    End of Report