fix(js): normalize & reject trace file DSN opts in oracle - #7480
Conversation
|
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)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughOracle DSN handling gains a ChangesOracle DSN trace-path sandboxing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 |
go-ora accepts `TRACE {FILE,DIR}`-style DSN options
and may create those files while opening the conn.
Normalize those paths and reject outside paths
unless `-allow-local-file-access` is enabled.
Signed-off-by: Dwi Siswanto <git@dw1.io>
0ccbe21 to
dbcf985
Compare
|
@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" \
--assignee "dwisiswant0" \
--title "[BUG] Oracle DSN TRACE options may create arbitrary files on the system" \
--body "## Description
The \`go-ora\` library used in the nuclei Oracle JS module accepts \`TRACE FILE\` and \`TRACE DIR\` style DSN (Data Source Name) options. When a database connection is opened using such a DSN, the library may create trace files at the paths specified in those options — including arbitrary locations on the filesystem.
This allows unintended or malicious file creation outside of allowed directories simply by crafting a DSN with trace path options, unless the \`-allow-local-file-access\` (\`-lfa\`) flag is explicitly enabled.
## Affected Component
- \`pkg/js/libs/oracle/oracle.go\` — \`OracleClient.ConnectWithDSN\`
## Expected Behavior
Oracle DSN trace path options should be normalized and rejected (with an appropriate error) if they point to paths outside the allowed templates directory, unless \`-allow-local-file-access\` is explicitly enabled.
## Actual Behavior
No validation is performed on trace path DSN options before passing the DSN to \`go-ora\`, allowing arbitrary file creation on the host system.
## Fix
Normalize DSN trace paths via \`protocolstate.NormalizePathWithExecutionId\` and reject any path falling outside the allowed location unless \`-lfa\` is enabled.
## References
- Fix in progress: https://github.com/projectdiscovery/nuclei/pull/7480
- Reported by: `@dwisiswant0`"Length of output: 1640
|
Proposed changes
go-ora accepts
TRACE {FILE,DIR}-style DSN optionsand may create those files while opening the conn.
Normalize those paths and reject outside paths
unless
-allow-local-file-accessis enabled.Proof
Checklist
Summary by CodeRabbit
Bug Fixes
Tests