---
title: "Security & Malware Detection"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/security"
image: "https://docs.vlt.io/og/client/security"
lang: "en"
---

# Security & Malware Detection

vlt provides powerful security analysis capabilities through integration with [Socket](https://socket.dev/), enabling you to identify and assess security risks in your dependencies. This guide covers how to use vlt's security-focused selectors to detect malware, vulnerabilities, and other security issues.

## Quick Security Scan

### Check for Any Malware

The simplest way to check for malware in your dependencies is using the parameterless `:malware` selector:

```bash title="Terminal"
$ vlt query ':malware'
```

This command finds packages with **medium or higher severity** malware alerts (critical, high, medium) but excludes low-severity alerts to focus on more serious threats.

### Check for All Security Issues

Get a comprehensive overview of all security-related packages:

```bash title="Terminal"
$ vlt query ':scanned'
```

This shows all packages that have been analyzed by Socket's security scanning.

## Malware Detection

The `:malware` selector is **binary** — it takes no parameters. Any matching result may have alerts or CVEs assigned to it.

```bash title="Terminal"
# Find any malware
$ vlt query ':malware'

# Find direct dependencies with malware

$ vlt query ':root > :malware'

# Find malware in production dependencies

$ vlt query ':prod :malware'

# Find malware in workspaces

$ vlt query ':workspace :malware'
```

## Vulnerability Detection

### Severity-Based Filtering

Use `:vuln` for severity-based vulnerability detection with four severity levels: **critical**, **high**, **medium**, and **low**.

```bash title="Terminal"
# Find critical vulnerabilities only
$ vlt query ':vuln(critical)'

# Find high severity and above

$ vlt query ':vuln(">=high")'

# Find medium or lower vulnerabilities

$ vlt query ':vuln(">=medium")'

# Include low severity alerts

$ vlt query ':vuln(low)'

# Parameterless :vuln matches severity >= medium

$ vlt query ':vuln'
```

### CVE, CWE, and Severity-Based Searches

```bash title="Terminal"
# Find packages affected by specific CVEs
$ vlt query ':cve(CVE-2023-1234)'

# Find packages with specific weakness types (CWE)

$ vlt query ':cwe(CWE-79)'

# Find packages based on CVE severity

$ vlt query ':severity(critical)' $ vlt query ':severity(">medium")'
```

## Behavioral Security Risks

### Code Execution Risks

```bash title="Terminal"
# Dynamic code execution
$ vlt query ':eval'

# Shell access

$ vlt query ':shell'

# Install scripts

$ vlt query ':scripts'
```

### Data Access Risks

```bash title="Terminal"
# File system access
$ vlt query ':fs'

# Network access

$ vlt query ':network'

# Environment variables

$ vlt query ':env'
```

### Code Quality Concerns

```bash title="Terminal"
# Obfuscated code
$ vlt query ':obfuscated'

# Minified code

$ vlt query ':minified'

# High entropy strings

$ vlt query ':entropic'
```

## Package Trust & Maintenance

### Package Legitimacy

```bash title="Terminal"
# Typosquatting detection
$ vlt query ':squat(critical)'

# Abandoned packages

$ vlt query ':abandoned'

# Manifest confusion

$ vlt query ':confused'
```

### Maintenance Status

```bash title="Terminal"
# Deprecated packages
$ vlt query ':deprecated'

# Unmaintained packages

$ vlt query ':unmaintained'

# Unstable ownership

$ vlt query ':unstable'
```

## License Compliance

### License Issues

```bash title="Terminal"
# Unlicensed packages
$ vlt query ':license(unlicensed)'

# Restricted licenses

$ vlt query ':license(restricted)'

# Copyleft licenses

$ vlt query ':license(copyleft)'
```

## Security Scoring

```bash title="Terminal"
# Find packages with low overall security scores
$ vlt query ':score("<0.5")'

# Find packages with low vulnerability scores
$ vlt query ':score("<0.7", "vulnerability")'

# Find packages with low maintenance scores
$ vlt query ':score("<0.6", "maintenance")'
```

## Comprehensive Security Audit

```bash title="Terminal"
# Multi-criteria security check - combine multiple selectors
$ vlt query ':malware, :eval, :shell, :obfuscated'

# Production dependencies security audit
$ vlt query ':prod (:malware, :cve(*), :deprecated, :abandoned)'

# Workspace security overview
$ vlt query ':workspace (:malware, :score("<0.5"), :unmaintained)'
```

## Cross-Project Security Analysis

### Cross-Project Security Scanning

```bash title="Terminal"
# Scan multiple projects using host
$ vlt query ':host(local) :malware'

# Specific project security check
$ vlt query ':host("file:~/my-project") :malware'
```

## Best Practices

### Regular Security Audits

1. **Daily Quick Check**: `vlt query ':malware'`
2. **Weekly Comprehensive Scan**: `vlt query ':host(local) :is(:malware, :not(:scanned))'`
3. **Before Releasing Projects**: `vlt query ':root :is(:malware, :score("<0.6"))'`

### Automated Security Monitoring

Consider integrating these queries into your CI/CD pipeline:

```bash title="security-check.sh"
#!/bin/bash
# Exit with error if any malware is found (using --expect-results)
vlt query ':malware' --expect-results=0 || {
echo "WARNING: Malware detected in dependencies!"
vlt query ':malware'
exit 1
}

# Alternative: Traditional approach with jq

if vlt query ':malware' --view=json | jq -e '.nodes | length > 0';
then echo "WARNING: Malware detected in dependencies!" vlt query
':malware' exit 1 fi
```

### Automation with --expect-results

The `--expect-results` flag is perfect for CI/CD pipelines and automated security checks:

```bash title="Terminal"
# Security gates that fail builds if issues are found
$ vlt query ':malware' --expect-results=0
$ vlt query ':cwe(1333)' --expect-results=0 # CWE-1333 is a ReDoS vulnerability
$ vlt query ':deprecated' --expect-results=0

# Quality gates with thresholds

$ vlt query ':score("<0.5")' --expect-results=0 $ vlt query
':unmaintained' --expect-results="<3"

# Ensure security scans are working

$ vlt query ':workspace' --expect-results=">0"
```

### Security-First Development

- Always check new dependencies: `vlt query '#<new-package>:malware, #<new-package> :malware'`
- Monitor transitive dependencies: `vlt query ':root > * :malware'`
- Regular maintenance updates: `vlt query ':deprecated, :unmaintained'`

## Understanding Security Data

Security data is provided by [Socket](https://socket.dev/) and requires network access to fetch the latest threat intelligence. The first query may take longer as security metadata is downloaded and cached locally. Results are cached for 3 hours; stale data is used while it refreshes in the background.

Requests to Socket time out after 30 seconds, retries included. Set `VLT_SECURITY_ARCHIVE_TIMEOUT=<ms>` (a positive integer, other values are ignored) to wait longer. On timeout vlt prints a warning and continues, treating the affected packages as unscanned: `:scanned` excludes them and security selectors such as `:malware` don't match them, but `:not(:malware)` does. In `vlt ls` and `vlt query`, combine with `:scanned`, e.g. `:scanned:not(:malware)`.

Scripts fail closed: when an `allow-scripts` or `vlt build --target` query uses security selectors, eligible packages (see below) with no security data never run their scripts, be it because the request timed out or because Socket has not scanned them yet, e.g. a version published minutes ago. `vlt build` reports them as not built along with the reason; run `vlt build` later to build them. `allow-skills` queries fail closed the same way: those packages' skills are reported and not linked, and [`vlt skills link`](https://docs.vlt.io/client/commands/skills.md) removes their links.

Packages are eligible when their origin is the public npm registry (`https://registry.npmjs.org/`) or the `registries.npm` URL: vlt's public npm mirror by default, or whatever URL is configured (for example a vlt.io npm mirror from [`vlt setup`](https://docs.vlt.io/client/commands/setup.md)). Packages from other registries have no security data.

`vlt login --registry=<url>` writes only the scalar `registry` option. If that URL is neither `https://registry.npmjs.org/` nor the `registries.npm` URL, those packages are not scanned. Use `vlt setup` or `vlt config set registries.npm=<url>` instead.

For more detailed information about specific security selectors, see the [Dependency Selector Syntax](https://docs.vlt.io/client/selectors/security-insights.md) reference.
