Capture addon --set option values are unvalidated/unescaped before mitmdump invocation #186
Labels
No labels
bug
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/hackmode#186
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reviewed at commit
3b4e2da(filed against capture wiring from26675e5, IPX addon #154; interacts with replay from6f40a44).Problem
capture-addon-setting(source/hackmode-core/capture-provider.lisp, ~line 50) formats addon options as(format nil "~a=~a" name value)and these are passed to mitmdump as--set name=value. There is no escaping or validation of VALUE.Repro
Operation id, capture-session id, or spool path values flow into these arguments directly (
make-capture-process-specification). A value containing a newline or control character, or an id containing=, is parsed differently by mitmdump than intended. Sincehackmode_spool_pathis a filesystem path derived from operation/session ids, malformed ids silently bind a wrong spool path and evidence lands in an unexpected file.Suggested fix
Validate operation/capture-session/spool ids and paths at
make-capture-process-specification(reject spaces, control chars,=in ids; reject control chars in paths), or pass options to mitmdump via a generated config file instead of CLI--set. Add a test that a spec with a malformed id fails loudly instead of binding a wrong spool path.