Skip to content

Latest commit

 

History

History
122 lines (83 loc) · 8.74 KB

Day07-AiTM-Insights-XDR.md

File metadata and controls

122 lines (83 loc) · 8.74 KB

Day 7 - AiTM attack insights

AiTM attack refers to "Adversary-in-The-Middle" phishing technique where attackers intercept communication between a user and a legitimate website, stealing passwords and session cookies to gain unauthorized access and perform fraudulent activities.

AiTM - "From cookie theft to BEC"

As part of the "From cookie theft to BEC" attack, the attacker initiates the process by sending phishing emails to the target. Upon clicking a link in the email, the user is directed to a fake website. At this point, the attackers establish a proxy server between the target user and the intended website. This setup allows the attacker to intercept and capture the user's password and session cookie, providing them with the means to authenticate and access the user's session on the website. After successfully authenticating, for example, to Outlook, they can read email content or create a forwarding rule to identify the target of the fraud. Once they have identified the target, they take action to initiate multiple fraud attempts.

image

Figure 1. AiTM attack kill chain, MS security blog, July 12, 2022

Open-source AiTM phishing toolkits

As there are tools available on the internet, attackers utilize them for conducting AiTM attacks.

Phishing mail pattern

At this time, based on third-party research, attackers are targeting enterprise users of Gmail or Outlook with emails related to password reset, password expiry, voice message logs, and accessing office-related and other content.

Initial access - phishing email

As the attacker aims to successfully lure the target to a phishing site and avoid detection by mail security, they primarily rely on two attack techniques, as follows.

  • Type Ⅰ : HTML file attachment
  • Type Ⅱ : Phishing link
  • Type Ⅲ : Open Redirect

Based on research conducted by third parties, Type Ⅰ has been observed that attackers commonly employ the technique of window.location.replace() to redirect users to phishing sites.

image

HTML attachment with URL redirection | Zscaler, AiTM report

e.g.

Language Code
JavaScript window.location.replace("hxxps://example.com")
JavaScript window.location.href = "hxxps://example.com"
HTML <meta http-equiv="refresh" content="7; url='hxxps://example.com'" />
PHP <?php header("Location: hxxps://example.com/"); exit; ?>

Note

JavaScript : "replace()" is used for one-time, immediate page replacement without maintaining history, while setting the "href" property allows navigation to a new URL while preserving the ability to go back using the browser's history.

PHP : JavaScript handles client-side redirection within the browser, while PHP manages server-side redirection on the server before the response is sent to the client's browser.


Open Redirect ?

An open redirect is a vulnerability in a web application that allows attackers to redirect users to malicious websites by manipulating URL parameters. It occurs when the application fails to validate or restrict user-supplied input used for redirection. Attackers exploit this vulnerability for phishing or other malicious purposes.

PHP : http://example.com/example.php?url=http://malicious.example.com
HTML : <a href="http://bank.example.com/redirect?url=http://attacker.example.net">Click here to log in</a>

Reference - CWE-601: URL Redirection to Untrusted Site ('Open Redirect')

Open Redirect pages, Zscaler, AiTM report


Base64

According to the Microsoft Security blog, attackers not only use URL redirection methods but also employ base64 encoding in JavaScript to encode the end-user's email address if it exists.

e.g. Microsoft observed that the redirector page used the following URL format:

hxxp://[username].[wildcard domain].[tld]/#[user email encoded in Base64]
JavaScript Memo
btoa() Encodes a string in base-64
atob() Decode a base-64 encoded string

Reference - Window btoa() / Window atob()

Source code of the HTML attachment, Microsoft, AiTM report

KQL : Hunting

Summarized each phase of the AiTM attack. These queries will help in hunting potential AiTM/BEC activities.

  1. 13-kql-AiTM-HuntingInsight-Part1.pdf
  2. 13-kql-AiTM-HuntingInsight-Part2.pdf
  3. 13-kql-AiTM-HuntingInsight-Part3.pdf
  4. 13-kql-AiTM-HuntingInsight-Part4.pdf

image

image

image

image

MS security blogs : AiTM attack timeline

MS blogs : AiTM attack insights

Other blogs

Disclaimer

The views and opinions expressed herein are those of the author and do not necessarily reflect the views of company.