Fix URL-encoded command passed to shell execution modules - #3637
Open
Dev9269 wants to merge 1 commit into
Open
Conversation
beef.encode.base64.decode escapes its output (escape/atob), so commands containing spaces or special characters were delivered percent-encoded and never executed by WScript.Shell.Run / nsIProcess. Wrap the decoded value in decodeURIComponent, matching the pattern used by the other command modules (deface_web_page, blockui, ...). Fixes beefproject#1854
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a command module value is decoded with
beef.encode.base64.decode, the result is URL-escaped, becausedecodeusesescape(atob(input))(core/main/client/encode/base64.js). Any command containing spaces or special characters (e.g.cmd.exe /c "echo Hello from BeEF!") was therefore delivered percent-encoded to the browser and never executed.Fix
Wrap the decoded value in
decodeURIComponentin the two modules that pass it to a shell/process runner, matching the pattern already used by the other command modules (deface_web_page,blockui,fake_notification, ...):modules/exploits/local_host/activex_command_execution/command.js(WScript.Shell.Run)modules/exploits/local_host/mozilla_nsiprocess_interface/command.js(nsIProcess)Fixes #1854