Skip to content

fix(compilers): reject path-like compiler versions before artifact write - #2922

Closed
0xoasis wants to merge 1 commit into
argotorg:stagingfrom
0xoasis:compilers-reject-version-path-traversal
Closed

fix(compilers): reject path-like compiler versions before artifact write#2922
0xoasis wants to merge 1 commit into
argotorg:stagingfrom
0xoasis:compilers-reject-version-path-traversal

Conversation

@0xoasis

@0xoasis 0xoasis commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

OpenAPI CompilerVersion uses ^v?\d+\.\d+\.\d+.*$, so values like 0.8.28/../../../tmp/pwn pass validation. path.join(solcRepo, \solc-${platform}-v${version}`)` can then escape the compiler cache directory.

Successful arbitrary write still requires a 200 from the compiler CDN (URLs are percent-encoded, so this usually 404s), but path construction is unsafe and should be rejected early.

Fix

  • Shared resolveCompilerArtifactPath helper rejects separators / .. and ensures the resolved path stays under the repo root
  • Used by solc, vyper, and fe executable getters
  • Unit tests for accept/reject cases and getSolcExecutable early throw

Related

Validation

# from packages/compilers
npx mocha --exit test/compilerArtifactPath.spec.ts

OpenAPI CompilerVersion allows trailing junk after semver (.*), so values
like 0.8.28/../../../tmp/pwn can make path.join(repo, fileName) escape the
compiler cache directory. Downloads usually 404, but the path construction
is still unsafe.

Validate version/fileName for separators and `..`, resolve under the repo
root, and share the helper across solc/vyper/fe getters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Sprint - Done

Development

Successfully merging this pull request may close these issues.

1 participant