Legal simulation flow: authorization gates campaign; pixel clicks feed awareness metrics.
🔎 Last updated · Editorial policy · Report an error
TL;DR: You Can Phish Your Own Staff Legally—Here’s How to Do It Safely with GoPhish
Yes—phishing your own employees is legal when you have written authorization, a defined scope, and a purpose of improving security awareness. GoPhish, the open-source phishing simulation framework, lets you run controlled campaigns that measure click rates and report rates against your own staff—without breaking the law. This guide walks you through the full setup: installation, sending profiles, templates, tracking pixels, credential-capture landing pages, and the metrics that actually matter to executives.
Authorization and Legal Groundwork Before You Send a Single Email
Let’s get the uncomfortable truth out of the way first: the same email that gets you a pat on the back as a security awareness lead can get you fired—or prosecuted—without a signature on a document. In the United States, the Computer Fraud and Abuse Act (CFAA) criminalizes unauthorized access to protected computers; in the UK, the Computer Misuse Act 1990 does the same. Social engineering that tricks a user into “authorizing” an action can constitute unauthorized access. Phishing simulations are legal precisely because the organization authorizes them—it’s the authorization that draws the line between a security program and a crime.
Before you build anything in GoPhish, get these in writing:
- Written approval from leadership (CISO, HR, and legal) explicitly naming the activity: simulated phishing against named populations.
- Scope document: which departments, how many users, which attack scenarios, which dates.
- Rules of engagement: no real credential storage, no targeting of personal accounts, a defined escalation path for users who report distress, and an exemption process for sensitive populations.
- HR and communications alignment: simulations must be framed as training, never as performance discipline.
CISA’s guidance on phishing simulation programs emphasizes transparency and a non-punitive culture—punishing clickers drives reporting underground, which is the opposite of what you want. Traditional penetration testing has a well-established scoping playbook; awareness simulations need the same rigor, just with HR in the room.
GoPhish Lab Setup: Installation and Initial Configuration
GoPhish (current release line: v0.12.1) is a single Go binary with an embedded SQLite database. For a lab, run it on an isolated VM or in Docker—never on a system shared with production credentials.
Binary install is trivial:
wget https://github.com/gophish/gophish/releases/download/v0.12.1/gophish-v0.12.1-linux-64bit.zip
unzip gophish-v0.12.1-linux-64bit.zip -d gophish
cd gophish && chmod +x gophish
./gophish
On first launch, GoPhish generates a random admin password and prints it to the console. The admin interface listens on https://localhost:3333; edit config.json to change listen_url if you need remote access (and use a strong password and TLS if you do). Phishing pages and mail sending run on ports 80/443 and 25 respectively—keep them free.
Change the default admin credentials immediately. A GoPhish instance exposed to the internet is itself a target; there’s no reason your simulation framework should ever be.
Creating Sending Profiles: SMTP, Gmail Relay, and Test Sends
Navigate to Sending Profiles → New Profile. You’ll configure:
- SMTP From: the header address your targets will see.
- Host:
smtp.gmail.com:587for a Gmail relay, or your lab SMTP server (mailhog:1025is handy for testing with zero external traffic). - Username/Password: for Gmail, an app password, not your primary credential.
- Ignore Certificate Errors: fine for labs, never in production sends.
Use the Send Test Email button before every campaign—it validates authentication and shows you exactly how headers render. For deliverability, the basics still apply: your sending domain needs valid SPF records authorizing your relay, DKIM signing if you’re going through a provider, and DMARC alignment if you want to demonstrate best practice to your own team. OWASP’s email spoofing guidance is the reference here. For a local lab, skip all of it—MailHog catches everything and teaches you the tool mechanics without touching a real mailbox.
Building Email Templates with Variables and Tracking Pixels
GoPhish templates use Go’s text/template syntax. Recipient fields are injected per-send:
Subject: {{.FirstName}}, your mailbox is at 95% capacity
Hi {{.FirstName}},
Your quota is nearly full. Verify your mailbox to avoid suspension:
{{.URL}}
— IT Service Desk
Available variables include {{.FirstName}}, {{.LastName}}, {{.Email}}, {{.Position}}, {{.TrackingURL}}, and {{.Tracker}}. That last one is the interesting bit for this tutorial: GoPhish’s tracking pixel works by injecting a 1×1 transparent image served from a unique URL—your GoPhish server’s /track endpoint combined with the recipient’s Result ID. When the mail client renders the image, the HTTP GET hits your server, which correlates the request to the specific recipient and logs an Email Opened event. No JavaScript, no cookies—just an image beacon, the same mechanism commercial trackers have used for decades.
Caveat: image proxying by Gmail and Outlook can fire the pixel before a human ever sees the message, inflating open rates. Treat opens as directional, not gospel—clicks and reports are the metrics you defend in a boardroom.
Crafting a Landing Page with Credential Capture
Under Landing Pages → New Page, you can paste HTML or use Import Site to clone a page by URL (this fetches the HTML and rewrites forms to point at GoPhish). Then decide what to capture:
- Capture Submitted Data: logs all form field values.
- Capture Passwords: logs password fields specifically—enable it only with explicit authorization, and only if you have a plan for the data.
- Redirect To: after submission, bounce the user to an awareness training page. This is your teaching moment; use it.
Here’s the professional standard: never store real passwords. Capture flags alone are usually sufficient to prove the click-and-submit event; if you enable password capture for demonstration purposes, encrypt the database, purge it after the campaign window, and document the purge. An awareness program that creates a credential-hoard liability has failed its own risk assessment.
Setting Up Users and Groups
Users & Groups is where you manage targets. CSV import accepts First Name, Last Name, Email, Position, Department. Tag groups by cohort—engineering-q1, finance-newhires—because segmentation is what turns raw click data into insight. A finance team hit with a fake invoice lure tells you something an org-wide blended rate never will. Keep pilot populations separate from campaign populations so your first clumsy run doesn’t poison your baseline.
Launching Your First Campaign and Launch Schedule
Campaigns → New Campaign pulls it together: name, SMTP profile, template, landing page, target group, URL (the link recipients click, pointing at your GoPhish host), and launch date. GoPhish supports scheduled launches and throttles sending so you don’t dump 2,000 emails into a mail gateway in three seconds and get the whole domain flagged. Launch it and watch the real-time dashboard: Email Sent, Opened, Clicked, Submitted, Reported events stream in live. For a first run, keep it small—20 to 50 targets, a benign lure, immediate redirect to a training page.
Measuring What Matters: Click Rate vs Report Rate
Every recipient generates a Result with a lifecycle of events. The four rates you’ll compute:
- Sent → Opened: open rate (pixel-dependent, directional only).
- Opened → Clicked: click rate—the headline number everyone quotes, and the one most prone to misinterpretation.
- Clicked → Submitted: credential submission rate—your highest-fidelity signal of real-world risk.
- Sent → Reported: report rate—the one most programs ignore and the one that predicts resilience best.
Click rate tells you how many people fell for it. Report rate tells you how many people noticed. A user who clicks and then reports it has done exactly what modern training asks: suspicious, engaged anyway, escalated anyway. The ratio that should headline your dashboard is reports ÷ (reports + clicks)—of all suspect interactions, how many did your staff catch without your simulation’s help?
Building a Reporting Awareness Metric That Executives Understand
One campaign tells you almost nothing. Trend lines across four or more campaigns tell a story: click rate declining quarter over quarter, report rate climbing, submission rate approaching zero. That trajectory is your maturity signal. The click-to-report ratio falling over time means detection is shifting from “someone in IT noticed” to “everyone noticed.” Pair this with external framing—CISA’s phishing guidance and the SANS security awareness maturity models give you vocabulary executives already trust.
Avoid vanity metrics ruthlessly. “97% of staff completed training” means nothing if the click rate didn’t move. Completion is an input; behavior change is the output.
Hands-On Lab: Full Command Walkthrough with Docker
docker pull gophish/gophish
docker run -d --name gophish -p 3333:3333 -p 80:80 -p 25:25 gophish/gophish
docker logs gophish 2>&1 | grep "Please login"
Expected output on first boot:
[INFO] Please login with the credentials admin / <random-16-char-password>
Grab campaign results via the API (create an API key under Settings):
curl -sk -H "Authorization: Bearer $GOPHISH_API_KEY"
https://localhost:3333/api/campaigns/1/results
Expected response shape:
{
"first_name": "Dana",
"last_name": "Reyes",
"email": "d.reyes@corp.local",
"status": "Clicked",
"reported": false,
"send_date": "2025-01-14T09:00:00Z",
"results": [{"label": "Clicked", "time": "2025-01-14T09:04:12Z"}]
}
Pull that JSON per campaign, and your awareness dashboard is a 40-line Python script away.
Common Pitfalls, Ethics, and Next Steps
Three failure modes sink awareness programs:
- Shaming clickers. Public leaderboards of who clicked destroy psychological safety—and psychological safety is what reporting depends on. Praise reporters, privately coach clickers.
- Mishandling captured data. Encrypt, minimize, purge. If you enabled Capture Passwords for a demo, that database is now a liability you must treat like production credentials.
- Inconsistency. One annual phishing blast is theater. Monthly or bi-monthly campaigns with rotating lure types build the reflexes.
For deepening your red-team skills beyond awareness sims, CTF-style practice ranges and hands-on labs in adjacent domains—like our XSS and server-side template injection walkthroughs—sharpen the same email-to-web attack chain thinking that phishing exploits.
Phish your own staff. Do it legally, do it kindly, measure what matters—and let the report rate, not the click rate, tell you whether the program is working.
Frequently Asked Questions
Is running a phishing simulation on employees legal?
Yes, with explicit written authorization from leadership and a defined scope covering populations, scenarios, and data handling. Without that authorization, the same activity may violate computer misuse laws such as the CFAA in the US or the Computer Misuse Act 1990 in the UK. Get legal and HR sign-off before your first send.
Does GoPhish store passwords entered on fake landing pages?
Only if you enable Capture Passwords on the landing page. Capture Submitted Data flags alone are usually sufficient evidence of a failed simulation. If you do capture passwords, encrypt the database, restrict access, and purge the data immediately after the campaign—never reuse or log captured credentials anywhere.
How does the GoPhish tracking pixel work?
GoPhish injects a 1×1 transparent image into every email, served from the recipient’s unique tracking URL (the {{.Tracker}} variable). When the mail client renders the image, the HTTP request hits GoPhish’s tracking endpoint, which correlates the Result ID and records an Email Opened event. Because image proxies can preload pixels, treat open rates as directional.
What is a good report rate for phishing simulations?
Trends matter more than absolutes. A rising report rate paired with a falling click rate across successive campaigns indicates improving awareness, regardless of the starting number. Compare cohorts against their own baselines rather than industry benchmarks, and track the click-to-report ratio as your headline maturity metric.
Can I run GoPhish campaigns from Gmail?
Yes—create an SMTP sending profile pointing at smtp.gmail.com:587 with an app password. But Gmail imposes volume limits and will not let you spoof arbitrary sender domains, which limits scenario realism. Local SMTP through MailHog or your own mail server is better for labs and controlled internal tests.
Related reading
#!/usr/bin/env bash
# GoPhish + MailHog lab setup (isolated VM only — never share with production creds)
set -euo pipefail
# --- GoPhish v0.12.1 binary install ---
wget https://github.com/gophish/gophish/releases/download/v0.12.1/gophish-v0.12.1-linux-64bit.zip
unzip gophish-v0.12.1-linux-64bit.zip -d gophish
cd gophish && chmod +x gophish
# On first launch GoPhish prints a random admin password to the console.
# Admin UI: https://localhost:3333 — change the default admin creds immediately.
# Edit config.json listen_url only if you need remote access (use strong password + TLS).
# Keep ports 80/443 (phishing pages) and 25 (SMTP) free.
./gophish &
cd ..
# --- MailHog: local SMTP catcher (mailhog:1025), zero external traffic ---
# Configure GoPhish Sending Profile:
# Host: mailhog:1025 From: it-servicedesk@lab.local
# Ignore Certificate Errors: ON (labs only)
# MailHog UI: http://localhost:8025 — inspect rendered headers + tracking pixel
docker run -d --name mailhog -p 1025:1025 -p 8025:8025 mailhog/mailhog
echo "[+] Lab ready. GoPhish admin: https://localhost:3333"
echo "[+] MailHog inbox: http://localhost:8025"
echo "[+] Before every campaign: use Send Test Email to validate the profile."Installs GoPhish v0.12.1 and MailHog for a fully local phishing-sim lab
Check your understanding
1. What is the key legal factor that separates a lawful phishing simulation from a crime like CFAA or Computer Misuse Act violations?
2. Why does the article warn against punishing employees who click simulated phishing emails?
3. How does GoPhish's tracking pixel detect that a recipient opened an email?
4. Why should a GoPhish instance never be exposed to the public internet?
Your answers stay in this browser only.

