fix(js): reject unsandboxed ccache writes in krbforge - #7482
Conversation
`OutputFile` was treated as a goimpacket option instead of a fs sink. Since goimpacket writes the ccache itself, krbforge had to enforce nuclei's local file policy before building the ticket config. Add execution-aware JS wrappers, normalize relative output paths into the template sandbox, and deny outside paths unless local file access is enabled. Keep empty output as in-memory only by passing "-". Signed-off-by: Dwi Siswanto <git@dw1.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesKerberos Ticket Forging: goja wrappers and sandbox output path enforcement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai create an issue for this, prefixed with |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
gh issue create \
--repo "projectdiscovery/nuclei" \
--title "[BUG] krbforge JS bindings do not enforce sandbox policy for ccache file writes" \
--body "## Description
The JavaScript bindings for the \`krbforge\` module do not enforce Nuclei's local file access sandbox policy when writing credential cache (ccache) files via the \`OutputFile\` option.
## Root Cause
\`OutputFile\` is treated as a goimpacket library option rather than a filesystem sink. Since goimpacket handles the actual ccache file writing internally, \`krbforge\` was unable to enforce Nuclei's local file access policies before the ticket configuration was built. This means a malicious or misconfigured template could write ccache files to arbitrary filesystem locations without requiring \`-allow-local-file-access\` to be explicitly enabled by the user.
## Impact
- Templates using \`krbforge.CreateGoldenTicket\` or \`krbforge.CreateSilverTicket\` with an \`OutputFile\` pointing outside the sandbox directory could write ccache files to arbitrary paths on the host filesystem.
- The sandbox restriction (\`-allow-local-file-access\`) is bypassed entirely for this code path.
## Steps to Reproduce
Use a Nuclei template that calls \`krbforge.CreateGoldenTicket\` or \`krbforge.CreateSilverTicket\` with an \`OutputFile\` path pointing outside the template sandbox directory (e.g., \`/tmp/evil.ccache\`) without passing \`-allow-local-file-access\`. The file will be written without restriction.
## Expected Behavior
Paths outside the sandbox directory should be rejected unless \`-allow-local-file-access\` is explicitly enabled. Empty or unspecified output paths should default to in-memory operations (passing \`\"-\"\` to the underlying library) rather than writing to disk.
## Related
- Fixed in PR `#7482`
/cc `@dwisiswant0`"Length of output: 1952
|
Proposed changes
OutputFilewas treated as a goimpacket optioninstead of a fs sink. Since goimpacket writes the
ccache itself, krbforge had to enforce nuclei's
local file policy before building the ticket
config.
Add execution-aware JS wrappers, normalize
relative output paths into the template sandbox,
and deny outside paths unless local file access is
enabled. Keep empty output as in-memory only by
passing "-".
Proof
Checklist
Summary by CodeRabbit
Bug Fixes
-allow-local-file-accessflag for external paths.Refactor