Fixes issue/fix-google-phishing-module (#3073) #3478
+27
−25
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.
Pull Request
Category
Bug
Feature/Issue Description
Q: Please give a brief summary of your feature/fix
A:
This PR fixes the Google phishing module failing on first run when executed via ARE. The module was generating runtime ReferenceError exceptions because required functions were not available in the execution context used by ARE and by inline event handlers.
Q: Give a technical rundown of what you have changed (if applicable)
A:
(1) Moved all module logic and helper functions inside beef.execute(function () { ... })
ARE can execute/evaluate only the beef.execute block (instead of evaluating the entire command.js file like normal UI module execution), so any functions defined outside the block may not exist at runtime, leading to “first run does nothing / second run works” behaviour.
(2)Exposed functions called by inline HTML event handlers to the global scope
The following changes were made because inline HTML event handlers (e.g. onclick="...") resolve function names from the global (window) scope:
(3)Replaced string-based setTimeout("...") usage with function references
The following changes were made to avoid string-based global evaluation and to ensure scheduled callbacks work correctly when functions are defined within beef.execute:
Test Cases
Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A:
{ "name": "Google Phishing", "author": "jking", "modules": [ { "name": "gmail_phishing", "condition": null, "code": null, "options": { "xss_hook_url": "https://myaccount.google.com/", "logout_gmail_interval": 10000, "wait_seconds_before_redirect": 1000 } } ], "execution_order": [0], "execution_delay": [0], "chain_mode": "sequential" }