The matchFileSnapshot function in src/assertions/snapshots.ts accepted a filePath parameter with zero validation. When snapshot update mode was active (UPDATE_SNAPSHOTS=1 or setUpdateMode('all')), an attacker who controls test input could write arbitrary content to any filesystem path the process has write access to, including creating intermediate directories.
File: src/assertions/snapshots.ts, lines 732-769
export function matchFileSnapshot(actual: unknown, filePath: string): void {
const serialized = serialize(actual);
const mode = resolveUpdateMode();
const fileExists = fs.existsSync(filePath);
if (!fileExists) {
if (mode === 'all' || mode === 'new') {
const dir = path.dirname(filePath);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
fs.writeFileSync(filePath, serialized, 'utf-8');
The filePath flows from expect(value).toMatchFileSnapshot(filePath) at index.ts:1033-1035 with no sanitization, no check that the path is within an expected directory, and no symlink resolution.
import { expect, setUpdateMode } from '@asymmetric-effort/nogginlessdom';
setUpdateMode('all');
// Writes arbitrary content to any writable path
expect('malicious content').toMatchFileSnapshot('/tmp/exploit/payload.txt');
// Path traversal via relative components
expect('data').toMatchFileSnapshot('../../../tmp/evil.txt');
// In CI environments, could overwrite CI config
expect('injected step').toMatchFileSnapshot('/home/runner/.github/workflows/backdoor.yml');
In CI/CD environments where test files may come from untrusted pull requests, this allows writing to any writable filesystem location with directory creation. An attacker could overwrite configuration files, inject code into build artifacts, or modify CI pipeline definitions.
Fixed in commit https://github.com/asymmetric-effort/NogginLessDom/commit/785e6ac6e124d1a89b3ccf40bbd75fc8e4cb215d on main. The matchFileSnapshot function now validates that the resolved file path is within the project root directory (defaults to process.cwd(), configurable via optional projectRoot parameter). Paths that resolve outside the project directory are rejected with a descriptive error.
export function matchFileSnapshot(
actual: unknown,
filePath: string,
projectRoot?: string,
): void {
const root = projectRoot ?? process.cwd();
const resolved = path.resolve(root, filePath);
if (!resolved.startsWith(root + path.sep) && resolved !== root) {
throw new Error(
`File snapshot path must be within the project directory: ${filePath}`,
);
}
// ... all subsequent file I/O uses `resolved` instead of `filePath`
}
A security vulnerability is a weakness in software, hardware, or configuration that can be exploited to compromise confidentiality, integrity, or availability. Many vulnerabilities are tracked as CVEs (Common Vulnerabilities and Exposures), which provide a standardized identifier so teams can coordinate patching, mitigation, and risk assessment across tools and vendors.
CVSS (Common Vulnerability Scoring System) estimates technical severity, but it doesn't automatically equal business risk. Prioritize using context like internet exposure, affected asset criticality, known exploitation (proof-of-concept or in-the-wild), and whether compensating controls exist. A "Medium" CVSS on an exposed, production system can be more urgent than a "Critical" on an isolated, non-production host.
A vulnerability is the underlying weakness. An exploit is the method or code used to take advantage of it. A zero-day is a vulnerability that is unknown to the vendor or has no publicly available fix when attackers begin using it. In practice, risk increases sharply when exploitation becomes reliable or widespread.
Recurring findings usually come from incomplete Asset Discovery, inconsistent patch management, inherited images, and configuration drift. In modern environments, you also need to watch the software supply chain: dependencies, containers, build pipelines, and third-party services can reintroduce the same weakness even after you patch a single host. Unknown or unmanaged assets (often called Shadow IT) are a common reason the same issues resurface.
Use a simple, repeatable triage model: focus first on externally exposed assets, high-value systems (identity, VPN, email, production), vulnerabilities with known exploits, and issues that enable remote code execution or privilege escalation. Then enforce patch SLAs and track progress using consistent metrics so remediation is steady, not reactive.
SynScan combines attack surface monitoring and continuous security auditing to keep your inventory current, flag high-impact vulnerabilities early, and help you turn raw findings into a practical remediation plan.