INE Client Side Attacks Course File
INE Client Side Attacks Course File
Course Introduction
Alexis Ahmed
Senior Penetration Tester @HackerSploit
Offensive Security Instructor @INE
[email protected]
@HackerSploit
@alexisahmed
Course + Introduction to Client-Side Attacks
Topic + Client-Side Attack Vectors
Overview + Client-Side Information Gathering & Fingerprinting
+ Introduction To Social Engineering
+ Social Engineering Techniques
+ Pretexting
+ Phishing with GoPhish
+ Resource Development & Weaponization
+ VBA Macro Development
+ Generating Malicious MS Word Documents
+ HTML Application (HTA) Attacks
+ HTML Smuggling
+ Browser-Based Attacks
+ Knowledge of the
penetration testing
lifecycle
+ Basic familiarity with
Prerequisites
Windows & Linux
+ Basic familiarity with the
Metasploit Framework
+ You will have an understanding of what Client-Side attacks are and
Learning the various types of client-side attacks utilized for initial access.
+ You will be able to perform client-side information and fingerprinting
Objectives: in order to identify key info regarding a target’s client-side
configuration (browser, OS etc).
+ You will have a solid understanding of what Social Engineering is, the
types of Social Engineering attacks used and the role of pretexting in
successful social engineering campaigns.
+ You will be able to plan, deploy and manage phishing
exercises/campaigns with tools like GoPhish.
+ You will have an understanding of what resource development and
weaponization are in terms of client-side attacks.
+ You will be able to develop your own VBA macros for initial access.
+ You will have the ability to leverage functionality like ActiveX Controls
to control/facilitate macro execution in documents.
+ You will be able to develop and customize your own Macro enabled
MS Office documents for use in obtaining initial access.
+ You will be able to leverage HTML Applications for initial access.
Let’s Get Started!
Introduction To Client-Side Attacks
Client-Side Attacks
● Client-side attacks refer to techniques and tactics used by attackers to
exploit vulnerabilities or misconfigurations in client-side software or the
systems accessed by users/employees of a target organization.
Target Target end-user devices, applications, or behaviors. Target servers, network infrastructure, or backend systems.
These attacks exploit vulnerabilities in software or systems These attacks focus on exploiting vulnerabilities in servers,
accessed by users, such as web browsers, email clients, or databases, web applications, or services hosted on remote servers.
office applications.
Objective Aim to compromise end-user devices, steal sensitive Aim to gain unauthorized access to servers or backend systems,
information, or establish a foothold within an organization's exfiltrate sensitive data, or disrupt services.
network.
These attacks often leverage social engineering tactics to These attacks may exploit vulnerabilities in server software,
trick users into performing actions that facilitate the attack. misconfigurations, or insecure server-side scripting.
Execution Typically involve the delivery of malicious content or Exploit vulnerabilities or weaknesses in server-side software,
payloads to end-user devices through channels such as services, or configurations.
phishing emails, malicious websites, or infected documents.
Examples Phishing, drive-by downloads, social engineering, malicious SQL injection, cross-site scripting (XSS), server-side request forgery
attachments, exploit kits targeting vulnerabilities in client- (SSRF), remote code execution (RCE), server misconfigurations,
side software. brute-force attacks against server authentication mechanisms.
How Client-Side Attacks Work
● Let's consider a fictitious example of a client-side attack targeting an
organization called "Acme Corp."
Step 1: Reconnaissance
+ The attacker begins by conducting reconnaissance on Acme Corp. using
publicly available information, social media profiles, company websites,
and job postings.
+ The attacker identifies employees, their roles, and potential targets
within the organization.
+ The attacker gathers information about Acme Corp.'s technology stack,
email domains, and common software applications used by employees.
How Client-Side Attacks Work
Step 2: Target Identification
+ Based on reconnaissance findings, the attacker identifies specific individuals
within Acme Corp. who are likely to have access to sensitive information or
valuable assets.
+ The attacker selects potential targets for the client-side attack, such as employees
in finance, human resources, or executive positions.
Step 7: Post-Exploitation
+ With access to the employee's device, the attacker may perform post-exploitation
activities, such as privilege escalation, lateral movement, or data exfiltration.
+ The attacker may escalate privileges to gain higher-level access within Acme
Corp.'s network, moving laterally to compromise additional systems or resources.
Client-Side Attack Methodology
Reconnaissance Target Identification
Payload/Resource
Development
Delivery
Execution
Post-Exploitation
Client-Side Attack Vectors
What are Attack Vectors?
● In the context of penetration testing, an attack vector refers to a path or
method used by an attacker to exploit vulnerabilities or weaknesses in a
system, network, or application.
● Attack vectors are the specific avenues through which an attacker gains
unauthorized access, achieves malicious objectives, or compromises the
security of a target environment.
Social Engineering:
+ Phishing Emails: Deceptive emails with malicious attachments or links to
trick users into clicking or downloading malware.
+ Social Media Engineering: Creating fake profiles to connect with users
and deceive them into clicking on malicious links or downloading
infected content.
+ Pretexting, Baiting, Tailgating: Various tactics used to manipulate users
into divulging sensitive information or performing actions that facilitate
the attack.
Client-Side Attack Vectors
Malicious Documents/Payloads:
+ Crafted documents (e.g., Microsoft Office files, PDFs) with embedded
macros, scripts, or exploits that execute malicious code upon opening.
Drive-by Downloads:
+ Hosting malicious content or exploit kits on compromised or malicious
websites to automatically download and execute malware when users
visit the site.
Exploit Kits:
+ Using automated kits to target vulnerabilities in web browsers, plugins,
or other client-side software, streamlining the process of delivering and
executing malicious payloads.
Client-Side Attack Vectors
Browser Exploitation:
+ Exploiting vulnerabilities in web browsers or their components (e.g.,
plugins, extensions) to execute arbitrary code or perform actions on the
victim's system.
Client-Side Information Gathering
Client-Side Information Gathering
● When performing a client-side attack, the success of the attack will
come down to the accuracy of the information you gather about your
target(s) and the client-side software and configuration running on the
target system(s).
+ Tools: Google Dorks for advanced search queries, Maltego for data
visualization and link analysis, theHarvester for email harvesting.
Passive Client Information Gathering Techniques
Search Engine Reconnaissance:
+ Examples: Using advanced search queries on search engines like Google
to discover publicly available information about target individuals,
organizations, or systems.
1. Initiating Contact:
+ Alice creates a fictitious persona named Sarah Johnson and submits a
resume to Acme Corporation's website using the resume upload feature.
+ The resume contains an embedded macro that triggers an error when
opened, simulating a corrupted document.
Active Client Information Gathering Example
Scenario: Leveraging Social Engineering for Active Client Information
Gathering
+ She then asks a seemingly innocuous question: "Could you please let me
know the version of Microsoft Word your team is using? I want to ensure
compatibility with future submissions."
Active Client Information Gathering Example
Scenario: Leveraging Social Engineering for Active Client Information
Gathering
5. Information Gathering:
+ Acme Corporation's HR representative, unaware of the malicious intent,
responds to Sarah's inquiry, providing details about the company's
Microsoft Word version.
Active Client Information Gathering Example
Scenario: Leveraging Social Engineering for Active Client Information
Gathering
+ She may also use it to tailor future social engineering attacks or craft
malicious payloads targeting specific software versions (Malicious Word
documents).
Client Fingerprinting
Client Fingerprinting
● Client fingerprinting is an active client information gathering technique
used to gather information about a target system’s web browser and
underlying operating system in order to aid in the development of tailor
made (client specific) payloads for initial access.
● This web server will typically be configured to run a script that obtains
information like the browser version and OS version from the browsers
of users who visit the site.
Browser Fingerprinting
● Browser fingerprinting is an active information gathering technique that
leverages client-side scripting languages like JavaScript to extract
information about the target’s browser and underlying operating system.
● This JavaScript code can be embedded into the homepage of the website
and should log/send the browser fingerprint of users who visit the web
page.
Browser Fingerprinting
● In order for this client-side information gathering technique to work, the
target’s/employee’s browser must be able to run the typical client-side
code used in modern web pages. For example, JavaScript.
Phishing Deceptive emails, messages, or websites designed to trick recipients into revealing confidential information, such as passwords, account
credentials, or financial data.
Spear Phishing Targeted phishing attacks that are customized for specific individuals or groups within an organization, often using personalized
information or context to increase credibility.
Vishing (Voice Phishing attacks conducted over phone calls or voice messages, where attackers impersonate legitimate entities (e.g., IT support, bank
Phishing) representatives) to extract sensitive information or manipulate victims into taking specific actions.
Smishing (SMS Phishing attacks conducted via SMS or text messages, where recipients are tricked into clicking on malicious links or providing sensitive
Phishing) information by impersonating trusted entities.
Pretexting Creating a false pretext or scenario to gain the trust of targets and extract sensitive information. This may involve impersonating authority
figures, colleagues, or service providers to manipulate victims into divulging confidential data.
Baiting Luring targets into performing a specific action (e.g., clicking on a malicious link, opening a malicious file) by offering enticing incentives or
rewards, such as free software, prizes, or job opportunities.
Tailgating Physically following authorized individuals into restricted areas or facilities without proper authentication. Attackers exploit social norms or
courtesy to gain unauthorized access to secure locations.
Phishing
● Phishing is one of the most prevalent and effective social engineering
attacks used in penetration testing and red teaming. It typically involves
the following steps:
1. Planning & Reconnaissance: Attackers research the target organization
to identify potential targets, gather information about employees, and
understand the organization's communication channels and protocols.
● Unlike traditional phishing attacks, which cast a wide net and aim to
deceive as many recipients as possible, spear phishing attacks are highly
personalized and customized to exploit the unique characteristics,
interests, and relationships of the intended targets.
Spear-Phishing Process
1. Target Selection & Research:
● Establishing Trust: The attacker uses the pretext to establish rapport and
build trust with the target. This may involve leveraging social
engineering techniques, such as mirroring the target's language, tone,
and behavior, to create a sense of familiarity and connection.
Characteristics of Pretexting
● Manipulating Emotions: Pretexting often exploits human emotions, such
as curiosity, fear, urgency, or sympathy, to manipulate the target's
behavior. By appealing to these emotions, the attacker can influence the
target's decision-making process and increase compliance with their
requests.
● This can be done by understanding how these terms have been used
and implemented into modern-day cybersecurity frameworks and kill
chains like, The MITRE ATT&CK Framework and the Cyber Kill Chain
(Lockheed Martin).
● Both the MITRE ATT&CK Framework and the Cyber Kill Chain are widely
used methodologies in cybersecurity, and they provide structured
approaches to understanding and analyzing cyber threats.
The MITRE ATT&CK Framework
● The MITRE ATT&CK framework is a globally-accessible knowledge base
of adversary tactics and techniques based on real world threats and
threat actors (APT groups). It was developed to improve the
understanding of how cyber attacks are performed.
● Red teaming often involves the use of the Cyber Kill Chain framework to
simulate and assess an organization's defensive capabilities.
The Cyber Kill Chain
Weaponization
● Weaponization is the process of taking the resources developed in the
previous phase and converting them into actual weapons that can be
used to exploit vulnerabilities and compromise the target system.
● Output: Resource development outputs tools, knowledge, and information about the target
environment. Weaponization outputs actual attack payloads or techniques ready for
deployment.
Adapted Client-Side Attack Methodology
Adapted Client-Side Attack Methodology
Phase Objectives Activities Outputs
Reconnaissance Gather information about the ● Conduct open-source intelligence (OSINT) ● Comprehensive reconnaissance report
target organization's systems, gathering to collect publicly available detailing the findings, including identified
networks, and potential information about the target organization, assets, potential attack surfaces, and areas of
vulnerabilities. including its employees, technologies used, weakness.
partners, etc.
Resource Acquire or develop the ● Identify and acquire tools and exploits ● Identify and acquire tools and exploits relevant
Development necessary tools, knowledge, and relevant to the target environment based on to the target environment based on
infrastructure to conduct the reconnaissance findings. reconnaissance findings.
simulated attack. ● Develop custom scripts, malware, or other ● Develop custom scripts, malware, or other
payloads tailored to exploit identified payloads tailored to exploit identified
vulnerabilities. vulnerabilities.
Weaponization Prepare the acquired or ● Configure and customize acquired exploits, ● Configure and customize acquired exploits,
developed resources for use in payloads, or malware to ensure compatibility payloads, or malware to ensure compatibility
the simulated attack. with the target environment. with the target environment.
● Craft phishing emails or other social ● Craft phishing emails or other social
engineering tactics to deliver malicious engineering tactics to deliver malicious
payloads. payloads.
● Develop or modify exploit code to take ● Develop or modify exploit code to take
advantage of identified vulnerabilities. advantage of identified vulnerabilities.
References & Resources
● Cyber Kill Chain (Lockheed Martin): https://www.lockheedmartin.com/en-
us/capabilities/cyber/cyber-kill-chain.html
● Objects and Methods: VBA allows users to work with objects that
represent elements of the Office application (e.g., worksheets, cells,
shapes) and manipulate them using methods and properties. For
example, in Excel, you can write VBA code to automate data
manipulation, chart creation, or report generation.
VBA Macros
VBA Macros
● In the context of client-side attacks and VBA (Visual Basic for
Applications), macros refer to small programs or scripts written in VBA
that automate tasks and extend the functionality of applications,
particularly within the Microsoft Office suite.
● MS Office 2007 took macro security a step further. Macros could not be
embedded at all within the default MS Word document file. This effort
was facilitated by the OfficeOpen XML standard, based on which
Microsoft introduced four distinct file formats.
MS Office File Formats
File Extension File Type Macros Permitted
DOCX compressed document No
DOTX compressed template No
DOCM compressed document Yes
DOTM compressed template Yes
● The file name extension plays no role on this data validation process. If
any error occurs during the data structure identification, the file being
analyzed will not be opened.
MS Office File Formats
● It should be noted that DOCM files containing macros can be renamed as
other file formats by changing the file extension and still keep their
macro executing capabilities.
● For example, an RTF file does not support macros, by design, but a
DOCM file renamed to RTF will be handled by Microsoft Word and will
be capable of macro execution.
WScript & VBA
WScript
● WScript is a Windows Script Host object model that provides a scripting
environment for executing scripts on Windows-based operating
systems.
● Displaying Messages: Using WScript, you can display dialog boxes and
messages to interact with users during the execution of VBA macros. For
example, you can show informative messages, warnings, prompts for user input,
or error notifications.
● ActiveX controls are similar to Java applets or browser plugins, but they
are specific to the Windows platform and are typically developed using
Microsoft's COM (Component Object Model) technology.
ActiveX
● These controls can perform a wide range of tasks, from providing user
interface elements (such as buttons or text boxes) to interacting with
system resources or external data sources.
● When using ActiveX controls for macro execution, the victim will a
warning message similar to the one shown in the image in the next slide.
ActiveX Controls
ActiveX Controls
There are a large number of
procedures related to ActiveX
control objects that are able to
automatically run a macro.
Sub InkEdit1_GotFocus()
End Sub
This is an example of downloading and executing an executable file using cmd.exe and
PowerShell. This technique is quite loud and has a very large on-disk footprint.
Demo: Using ActiveX Controls For
Macro Execution
Pretexting Phishing Documents
Demo: Pretexting Phishing
Documents
HTML Applications (HTA)
HTML Applications
● HTML Applications (HTA) are a type of application created using HTML,
CSS, and JavaScript that run in a special environment provided by
Internet Explorer (IE) or Microsoft Edge (specific builds).
● HTA files have the .hta extension and can be executed on Windows
systems like standalone applications, providing a way to create rich
graphical user interfaces (GUIs) and leverage scripting capabilities.
● This attack vector only works on Internet Explorer. In this case, why
would this be a viable vector given that other third-party browsers are
used over IE?
● This host provides a security context that allows HTAs to have more
privileged access to the system than standard web pages.
● HTAs have access to the local filesystem, registry, and can execute
ActiveX controls, making them powerful tools for scripting tasks on
Windows systems.
HTAs & Client-Side Attacks
Scripting Capabilities:
● HTAs can contain JavaScript code that can interact with the underlying
Windows operating system.
Security Considerations:
● mshta.exe imposes certain security restrictions to mitigate potential risks
associated with executing HTA files.
● For example, HTAs executed by mshta.exe are subject to the Internet
Explorer security zone settings, which can restrict their ability to access
certain resources or perform potentially harmful actions.
Demo: HTML Applications (HTA)
HTA Attacks
Demo: HTA Attacks
Automating Macro Development
With MacroPack
Automating Macro Development
● So far, we have explored the various techniques and tools that can be
used to develop MS Office macros manually.
● Now that we have a fundamental understanding of how MS Office
macros work, how to develop your own VBA Macros and how to
weaponize VBA Macros, we can now explore the process of automating
the macro development process.
● The primary reason why we explored the manual techniques first, is so
that we have an understanding of how macros work before we start
including or using automated frameworks/tools to generate the macros
for us.
Introduction to MacroPack
● MacroPack is an open source community tool/framework developed in
Python 3 that is used to automate the development and weaponization
of MS Office macros for initial access.
● MacroPack is a popular tool that is used in red teaming, pentests, and
social engineering assessments.
● It goes beyond standard automation by providing you with the ability to
obfuscate the macros in the MS Office document. It also simplifies and
automates the process of generating MS Office macros that can evade
AV solutions.
● Furthermore, it also supports a wide variety of MS Office file formats
such as the MS Office retro document formats, for example; .doc.
MacroPack Formats
● Scripting formats:
○ VBA text file (.vba)
○ VBS text file (.vbs)
○ Windows Script File (.wsf)
○ HTML Applications (.hta)
● Obfuscation options:
○ Renaming functions
○ Renaming variables
○ Removing spaces
○ Removing comments
○ Encoding strings
References & Resources
● MacroPack GitHub Repo: https://github.com/sevagas/macro_pack
Lab Demo: Automating Macro
Development With MacroPack
File Smuggling With HTML &
JavaScript
Delivery
● This is the phase in which the attacker delivers the payload or malicious
document to the target, preparing for subsequent actions like
exploitation and execution.
● Delivery Through Email or Web: The attacker delivers the HTML content
via email (in the form of HTML email bodies or attachments) or through a
compromised or malicious website. Since the payload is hidden within
HTML, it's less likely to be detected by security tools that focus on
scanning email attachments or web traffic for malware signatures.
How HTML Smuggling Works
● Reconstruction and Execution: Once the HTML content reaches the
target's browser, the payload is reconstructed and executed. This could
involve JavaScript logic to decode and reassemble the payload, leading
to various outcomes, such as executing malicious scripts or downloading
additional payloads.
Lab Demo: File Smuggling With
HTML & JavaScript
Initial Access Via Spearphishing
Attachment
Demo: Initial Access Via
Spearphishing Attachment
Establishing A Shell Through The
Victim's Browser
Demo: Establishing A Shell
Through The Victim's Browser
Client-Side Attacks
Course Conclusion
+ You will have an understanding of what Client-Side attacks are and
Learning the various types of client-side attacks utilized for initial access.
+ You will be able to perform client-side information and fingerprinting
Objectives: in order to identify key info regarding a target’s client-side
configuration (browser, OS etc).
+ You will have a solid understanding of what Social Engineering is, the
types of Social Engineering attacks used and the role of pretexting in
successful social engineering campaigns.
+ You will be able to plan, deploy and manage phishing
exercises/campaigns with tools like GoPhish.
+ You will have an understanding of what resource development and
weaponization are in terms of client-side attacks.
+ You will be able to develop your own VBA macros for initial access.
+ You will have the ability to leverage functionality like ActiveX Controls
to control/facilitate macro execution in documents.
+ You will be able to develop and customize your own Macro enabled
MS Office documents for use in obtaining initial access.
+ You will be able to leverage HTML Applications for initial access.
Thank You!
EXPERTS AT MAKING YOU AN EXPERT