Jasper Alblas
Jasper Alblas
Mastering Data & Cybersec
Welcome to this walkthrough of the Phishing Prevention Room on TryHackMe. Now that we have learned about phishing emails and how to identify them as such, we are ready to learn about the prevention of said phishing emails. Let’s go!

Room URL:
https://tryhackme.com/room/phishingemails4gkxh
I am making these walkthroughs to keep myself motivated to learn cyber security, and ensure that I remember the knowledge gained by these challenges on HTB and THM. Join me on learning cyber security. I will try and explain concepts as I go, to differentiate myself from other walkthroughs.
Phishing remains one of the most common and effective ways for attackers to gain initial access to target systems. To counter this, defenders can deploy a variety of tools and controls designed to protect users from malicious emails.
The MITRE ATT&CK Framework describes Phishing for Information as the attempt to trick targets into divulging information.
In this room, you’ll learn about various security measures organizations can implement to prevent, detect, and mitigate phishing threats.
Answer: No answer needed
Sender Policy Framework (SPF) is an email security mechanism that helps prevent phishing and email spoofing. It allows receiving mail servers to check whether an email was sent from a server that is authorized to send mail on behalf of a specific domain.
In simple terms: SPF answers the question “Is this server allowed to send email for this domain?”
When an email is received, the recipient’s mail server performs the following steps:
This entire process happens automatically and in milliseconds.
The SPF check returns a result that tells the receiving server how trustworthy the email is:
| SPF Result | What Happens |
|---|---|
| Pass, Neutral, None | Email is accepted and delivered normally |
| SoftFail, PermError | Email is delivered but flagged as suspicious |
| Fail, TempError | Email is rejected |
From a SOC perspective, SoftFail messages are particularly interesting, as they often appear in phishing or misconfigured email setups.
An SPF record is stored as a DNS TXT record. Here’s a simple example:
v=spf1 ip4:127.0.0.1 include:_spf.google.com -allv=spf1ip4:127.0.0.1include:_spf.google.com-allThat final -all is important — it tells receiving servers to reject unauthorized senders, which significantly reduces spoofing.
Some domains don’t list IP addresses directly. Instead, they use include statements to reference third-party email providers such as Google Workspace, HubSpot, or Chargebee.
In these cases, all IP addresses authorized by the included domains are treated as valid senders.
Two commonly used tools are:
For example, an SPF result of SoftFail indicates the sending server is not explicitly authorized, but the email was still accepted and marked as suspicious — a common finding in phishing investigations.
SPF is one of the first checks used by mail servers to evaluate sender legitimacy. While it does not stop phishing on its own, it plays a crucial role when combined with DKIM and DMARC.
For defenders and SOC analysts, understanding SPF helps:
Let’s have a look at the mentioned screenshot:

We are interested in the mail servers mentioned directly after a include. Here we can see three domains: google.com, chargebee.com, and finally hubspotemail.net.
Answer: 3
SoftFail verification result?As we discussed earlier, an email that returns a SoftFail result gets sent but gets flagged. The intended action is therefore flag.
Answer: flag
DomainKeys Identified Mail (DKIM) is an email authentication method that verifies whether an email message has been tampered with and truly originates from the sending domain.
Like SPF, DKIM is an open standard used for email authentication and DMARC alignment. However, DKIM has a major advantage: it survives email forwarding, which makes it more reliable than SPF and a core building block of modern email security.
In short: DKIM answers the question “Was this email really sent by this domain, and was it changed along the way?”
DKIM uses public-key cryptography to validate email authenticity.
Here’s the process at a high level:
If verification fails, the email may be flagged as suspicious or rejected, depending on policy.
Unlike SPF, which validates the sending server’s IP address, DKIM validates the content and signature of the message itself.
As long as the message body and signed headers are not modified, DKIM remains valid — even if the email passes through multiple mail servers. This makes DKIM especially valuable in real-world mail flows.
A DKIM record is stored as a DNS TXT record and contains the public key needed to verify the email signature.
v=DKIM1; k=rsa; p=<public_key>v=DKIM1k=rsap=<public_key>DKIM records can include additional tags depending on the mail provider and configuration, which is why they often look more complex than SPF records.
When analyzing email headers, DKIM results are commonly displayed alongside SPF and DMARC.
A DKIM result of permerror indicates a permanent failure, meaning the verification process could not be completed. Common causes include:
From a SOC perspective, DKIM permerrors are strong indicators of either misconfigured infrastructure or malicious email activity.
Two useful tools for working with DKIM are:
pass, fail, or permerrorDKIM plays a critical role in defending against email-based attacks. It ensures:
Together with SPF and DMARC, DKIM forms the foundation of modern email security. For SOC analysts, understanding DKIM is essential when investigating phishing attempts, spoofed domains, and suspicious email headers.
permerror?Let’s have a look at the header:
Well, it says the answer in parentheses right after the permerror, so this is an easy one. There is apparently lacking a key.
Answer: no key for signature
Domain-Based Message Authentication, Reporting, and Conformance (DMARC) is an open standard that builds on SPF and DKIM to protect domains from email spoofing and phishing.
While SPF and DKIM authenticate different parts of an email, DMARC ties their results together using a concept called alignment. It ensures that the domain visible to the user matches the domain that was actually authenticated.
In simple terms:
DMARC answers the question “Can I trust that this email truly comes from the domain it claims to be from?”
When an email is received, the mail server:
If SPF and/or DKIM fail alignment, DMARC tells the receiving server exactly what to do with the email.
Alignment means that the domain in the From: header matches the domain validated by SPF and/or DKIM.
At least one of them must pass and align for DMARC to succeed.
A DMARC record is published as a DNS TXT record and defines how failed emails should be handled.
v=DMARC1; p=quarantine; rua=mailto:postmaster@website.comv=DMARC1p=quarantinenone and reject)rua=mailto:postmaster@website.com| Policy | Meaning |
|---|---|
p=none | Monitor only (no enforcement) |
p=quarantine | Treat failing emails as spam |
p=reject | Reject failing emails outright |
From a security perspective, moving from none → quarantine → reject is a sign of increasing email maturity.
Tools like dmarcian’s Domain Checker allow you to inspect SPF, DKIM, and DMARC records together and quickly identify misconfigurations.
For example, large organizations such as Microsoft use a p=reject policy. This means that any email failing DMARC checks is immediately rejected, making domain spoofing significantly harder.
DMARC is where email authentication becomes actionable. Unlike SPF and DKIM alone, DMARC allows domain owners to:
For SOC analysts, DMARC helps:
Together, they form the foundation of modern email security.
p=reject provides the greatest amount of projection, as it blocks (rejects) email sent if they fail validation checks.
Answer: p=reject
Secure/Multipurpose Internet Mail Extensions (S/MIME) is a standard used to digitally sign and encrypt email messages. Unlike SPF, DKIM, and DMARC—which protect domains—S/MIME protects the actual email content and the individual sender.
In simple terms:
S/MIME ensures that an email is private, authentic, and has not been altered.
S/MIME is built on public key cryptography and provides two primary security functions: digital signatures and encryption.
Digital signatures allow the recipient to verify who sent the message and whether it was modified.
They provide:
Encryption protects the confidentiality of the email content.
It provides:
To use S/MIME, users must have a digital certificate, which contains their public key and is issued by a trusted Certificate Authority (CA).
Here’s a simplified workflow:
Once certificates are exchanged, future emails can be signed and encrypted automatically.
Unlike domain-based protections, S/MIME:
From a blue-team perspective, S/MIME is commonly seen in:
| Technology | Protects | Focus |
|---|---|---|
| SPF | Domain | Sending server authorization |
| DKIM | Domain | Message integrity |
| DMARC | Domain | Policy enforcement |
| S/MIME | Individual user | Message confidentiality and authenticity |
S/MIME does not replace SPF, DKIM, or DMARC — it complements them by securing the email itself.
For defenders, S/MIME helps:
While S/MIME increases security, it can also reduce visibility for email security tools, making awareness and proper configuration essential.
Encryption ensures that only the recipient can read the contents of an email message, since she needs a private key to decrypt the message.
Answer: Encryption
In this task, you will analyze a PCAP file with SMTP traffic. Some familiarity with traffic analysis using Wireshark will be helpful, as well as knowledge of SMTP Wireshark filters and status codes.
Go ahead and deploy the machine attached to this task. It will appear in the split-screen view when it’s ready. Then, open the traffic.pcap file on the Desktop to begin your examination.
Look at the site linked in the description: https://www.wireshark.org/docs/dfref/s/smtp.html.
This site is filled with useful Wireshark filters related to SMTP. One of them (one of the last entries) includes smtp.response.code, which allows us to filter on SMTP response codes.
Answer: smtp.response.code
220 Service ready?Go ahead and startup the machine. Find the pcap file on the Desktop and open it in Wireshark. Now we get to use the filter we found in the previous question.
I am going to assume that you have some basic Wireshark knowledge (otherwise I have some awesome Wireshark walkthroughs here :D).
For this question we simply need to filter the earlier found attribute on the value 220:
smtp.response.code eq 220You will see the following 19 packets (see the answer in the complete bottom):

Answer: 19
spamhaus.org. What response code did the server return?Now, make sure to remove the filter on smtp response 220. We still need to focus on smtp trafic so just keep “smtp” in the filter. Now, search on string values by pressing Control + F, or press Edit -> Find Packet. Make sure you search on string, and enter the value of spamhaus.org. See the below screenshot:

The response code we are looking for is 553.
Answer: 553
Response code: message?You can find the answer to this in the above screenshot, just below the response code.
Answer: Requested action not taken: mailbox name not allowed (553)
552. How many messages were blocked for presenting potential security issues?You probably know how to do this now. Simply enter the following filter:
smtp.response.code eq 552
Answer: 6
In this task, you’ll move beyond SMTP status codes and responses and begin analyzing SMTP traffic using the same traffic capture from the task above. You will utilize the Internet Message Format (IMF) to examine the inner details of emails, such as sender and recipient fields, content type, and attachments.
Simply enter the following filter to only show smtp packets:
smtpAnswer: 512
270?To find this packet, you can press Ctrl + G to find a packet (or press Go -> Go to Packet). Enter 270 and press “Go to packet”.
Look in the packet details under SMTP and you will find the answer:

Answer: document.zip
270, which Host IP address is not responding, making the message undeliverable?The answer is also in the above screenshot, on line 4 of the details above.
Answer: 212.253.25.152
imf, which email client was used to send the message containing the attachment attachment.scr?Internet Message Format (IMF) is the standard for structuring text-based emails (headers like To, From, Subject, Date) that runs over protocols like SMTP. In it we can find more details on the contents of emails.
Filter on imf. Now, take a look at the 7 packets found. One of them mentions the attachment.scr file.

If you look for the X-Mailer field you will also find the email client.
Answer: Microsoft Outlook Express 6.00.2600.0000
Just below the attachment name, there exists a field called Content-Transfer Encoding. This is set to base64.
Answer: base64
While mechanisms like SPF, DKIM, and DMARC help authenticate emails, they are not enough on their own to stop phishing. Modern email systems use additional layers of defense to reduce risk.
This is clearly a sandboxing environment the team needs.
Answer: Sandboxing
In this room, you explored how technologies like SPF, DKIM, DMARC, and S/MIME work together to authenticate email and protect users against phishing. You then learned how to interpret SMTP response codes and analyze SMTP traffic to understand how email servers handle messages. Finally, you examined the tools and technologies organizations use to detect and prevent phishing attempts, combined with user-focused awareness and reporting mechanisms.
Explore the rooms below to expand your understanding of phishing.
Answer: No answer needed.

Congratulations on completing Phishing Prevention. This is one of the better rooms out there, and I really like the combination of theory, practice and a bit of Wireshark to really make the theory relevant. Thanks for reading!
Come back soon for more walkthroughs of rooms on TryHackMe and HackTheBox, and other Cybersecurity discussions.
Find my other TryHackMe SOC Level 1 Path walkthroughs here.
Find my other walkthroughs here.
You are welcome to comment on this post, or share my post with friends.I would be even more grateful if you support me by buying me a cup of coffee:

I learned a lot through HackTheBox’s Academy. If you want to sign up, you can get extra cubes, and support me in the process, if you use the following link:
[…] Phishing Prevention […]