Skip to content

Conversation

@kaitozaw
Copy link
Collaborator

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:

  • function clickedSubmitButton() => window.clickedSubmitButton = function ()
  • function redirect() => window.redirect = function ()

(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:

  • setTimeout('logoutGoogle()', ...) => setTimeout(logoutGoogle, ...)
  • setTimeout("redirect()", ...) => setTimeout(window.redirect, ...)

Test Cases

Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A:

  1. Create beef/arerules/enabled/gmail_phishing.json
{
  "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"
}
  1. Start beef, open demo page and check if the Google phishing module is executed on first run. Also check if the module is executed correctly without the ARE.

@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request December 24, 2025 03:51 — with GitHub Actions Inactive
@kaitozaw kaitozaw force-pushed the issue/3073-fix-google-phishing-module branch from 21486c2 to e227ea7 Compare December 30, 2025 04:19
@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request December 30, 2025 04:19 — with GitHub Actions Inactive
@kaitozaw kaitozaw force-pushed the issue/3073-fix-google-phishing-module branch from e227ea7 to f6f2def Compare December 31, 2025 05:14
@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request December 31, 2025 05:14 — with GitHub Actions Inactive
@zinduolis zinduolis linked an issue Jan 2, 2026 that may be closed by this pull request
@kaitozaw kaitozaw force-pushed the issue/3073-fix-google-phishing-module branch from f6f2def to 15d2acf Compare January 2, 2026 23:34
@kaitozaw kaitozaw temporarily deployed to Integrate Pull Request January 2, 2026 23:34 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google Phishing module doesn't execute properly as an ARE Rule

1 participant