Module 2.4
Module 2.4
Module 2.4
Mitigating
Vulnerabiliti
es
In this chapter you will learn:
• Here are some common tools and techniques for XXE mitigation:
Input validation and sanitization
Disabling external entities and DTDs
Using a secure XML parser
Containerization and virtualization
Using a web application firewall
Regularly updating software
Structured Query Language Injection
(SQLi)
• SQL injection (SQLi) is a popular form of injection in which an attacker injects arbitrary
SQL commands to extract data, read files, or even escalate to an RCE.
• These attacks are not particularly sophisticated, but the consequences of their
successful usage are particularly damaging, because an attacker can obtain, corrupt,
or destroy database contents.
• Attackers can use several different types of SQL injection attacks to compromise a web
application.
• If you are examining logs, you should be able to recognize why a query such as
“SELECT * FROM table WHERE id=1-SLEEP(15)” looks suspicious.
Structured Query Language Injection
(cont.)
• The following are some common tools and techniques for SQLi mitigation:
Input validation and sanitization
Parameterized queries
Least privilege access
Database firewalls (DBFWs) and proxies
Regularly updating software
Database encryption
Database activity monitoring
Using stored procedures
Cross-Site Scripting
• Cross-site (XSS)
scripting (XSS) is a type
of injection attack that leverages a
user’s browser to execute malicious
code that can access sensitive
information such as passwords and
session information.
• XSS comes in two forms: persistent
(stored) and nonpersistent
(reflected).
• Another type of attack, called a
DOM-based XSS attack, occurs
when an attacker injects a malicious
script into the client-side HTML
being parsed by a browser.
Cross-Site Scripting (cont.)
• The following are several tools and techniques for XSS prevention and mitigation:
Input validation and sanitization
Output encoding
Contextual output encoding
Content Security Policy (CSP)
HTTPOnly cookies
X-XSS-Protection header
Web application firewall
Security testing
Regularly updating software
Cross-Site Request Forgery (CSRF)
• Cross-site request forgery (CSRF) is an attack that exploits the trust a website has in a
user’s browser.
• The attack works by tricking a user into performing an action on a website without
their knowledge or consent. This is achieved by a malicious actor crafting a request
that is sent to the target website and is designed to mimic a legitimate request.
• When the victim interacts with the website, the browser will send the crafted request,
causing the website to perform an unintended action.
• The victim will be unaware of the attack, as the attacker is able to piggyback on the
victim’s previously authenticated session.
Cross-Site Request Forgery (cont.)
• Here are some tools and techniques for preventing and mitigating CSRF attacks:
HTTP Referer
SameSite attribute
CAPTCHAs
CSRF tokens
CSRF protection frameworks
User re-authentication
Multifactor authentication
Web application firewall
Regularly updating software
Directory Traversal
• A directory traversal attack enables an attacker to view, modify, or execute files in a
system that they wouldn’t normally be able to access.
• For web applications, these files normally reside outside of the web root directory and
should not be viewable.
• However, if the server has poorly configured permissions, a user may be able to view
other assets on the server.
• If an attacker determines a web application is vulnerable to directory traversal attack,
they may use one or more explicit Unix-compliant directory traversal character
sequences (../) or an encoded variation of it to bypass security filters and access files
outside of the web root directory.
Directory Traversal (cont.)
• Here are some common tools and techniques for preventing and mitigating directory
traversal attacks:
Input validation
Principle of least privilege
Filename sanitization
Secure coding practices
File-handling libraries
Reverse proxy
Process isolation
Web application firewall
Regularly updating software
Server-Side Request Forgery (SSRF)
• SSRF, or server-side request forgery, refers to a vulnerability that arises when a web
application allows a user to specify a URL to fetch a remote resource, without properly
validating the URL.
• This can allow an attacker to send a crafted request to an unexpected destination,
potentially bypassing firewalls, virtual private networks (VPNs), and other network
access controls.
• Common tools and techniques for prevention and mitigation of SSRF are as follows:
Input validation
Principle of least privilege
URL validation and sanitization
Secure coding practices
Web application firewall
Buffer Overflow
Vulnerabilities
Attackers often will write malware that takes
advantage of some quality or operation of
main memory.
Buffer Overflow
• The temporary space that a program has allocated to perform operating system or
application functions is referred to as the buffer.
• Buffers usually reside in main memory, but they may also exist in hard drive and
cache space.
• When the volume of data exceeds the capacity of the buffer, the result is buffer
overflow. If this occurs, a system may attempt to write data past the limits of the
buffer and into other memory spaces.
• Buffer overflows affect nearly every type of software and can result in unexpected
results if not managed correctly.
Buffer Overflow (cont.)
• Here is a list of prevention and mitigation techniques for buffer overflow
vulnerabilities:
Input validation
Principle of least privilege
Runtime application self-protection (RASP)
Secure coding practices
Stack canaries
Address space layout randomization (ASLR)
Data execution prevention (DEP)
Code signing
Heap randomization
Stack-Based Attacks
• Stack-based buffer overflows work by overwriting key areas of the stack with too much
data to enable custom code, located elsewhere in memory, to be executed in place of
legitimate code.
• The first widely distributed Internet worm was made possible through a successful
stack-based buffer attack.
• The Morris Worm, written by graduate student Robert Tappan Morris from Cornell
University in the late 1980s, took advantage of a buffer overflow vulnerability in a
widely used version of fingerd, a daemon for a simple network protocol used to
exchange user information.
• The stack is a very structured, sequential memory space, so the relative distance
between any two local variables in-memory is guaranteed to be relatively small.
• Buffer overflows affect nearly every type of software and can result in unexpected
Heap-Based Attacks
• Attacks targeting the memory heap are usually more difficult for attackers to
implement because the heap is dynamically allocated.
• In many cases, heap attacks involve exhausting the memory space allocated for a
program.
Integer Attacks
• An integer overflow takes advantage of the fixed architecturedefined memory regions
associated with integer variables.
• In many cases, heap attacks involve exhausting the memory space allocated for a
program.
Broken Access
Control
Broken access control is a term used to
describe the failure of access controls to
prevent unauthorized access to sensitive data
or functionality.
Broken Access Control
• This vulnerability can occur when an application fails to properly enforce access
controls, such as authentication or authorization.
• The impact of broken access control can be severe, allowing attackers to access
sensitive information, modify data, or execute unauthorized actions on behalf of
legitimate users.
• Broken authentication attacks attempt to gain control of one or more accounts by
granting the attacker the same privileges as the victim. Authentication is "broken"
when attackers are able to assume user identities via compromising passwords, keys
or session tokens, user account information, and other details.
• Common examples of broken access control vulnerabilities include vertical privilege
escalation, horizontal privilege escalation, insecure direct object references, and lack
Broken Object Level Authorization
• When exposing services via APIs, some servers fail to authorize on an object basis,
potentially creating the opportunity for attackers to access resources without the
proper authorization to do so.
• In some cases, an attacker can simply change a URI to reflect a target resource and
gain access.
• Broken authentication attacks attempt to gain control of one or more accounts by
granting the attacker the same privileges as the victim. Authentication is "broken"
when attackers are able to assume user identities via compromising passwords, keys
or session tokens, user account information, and other details.
• Broken object level authorization (BOLA) checks should always be implemented and
access granted based on the specific role of the user.
Broken Object Level Authorization (cont.)
• Here is a list of common tools and techniques for mitigating and preventing broken
object level authorization:
Role-based access control (RBAC)
Attribute-based access control (ABAC)
Least privilege
Access control testing
Proper error handling
Session management
Regular software updates
Web application firewall
Business object level authorization (BOLA)
Business flow level authorization (BFLA)
Broken User Authentication
• The goal of the attacker is to introduce biased or malicious data into the training set,
which can then result in incorrect or harmful decisions by the model.
• Attackers can conduct data poisoning attacks through a variety of methods, including
injecting biased or malicious data directly into the training set, manipulating data
sources or sensors to produce biased data, and manipulating human input used to
label or classify data.
• The impact of a successful data poisoning attack can be severe, ranging from incorrect
or inaccurate decisions by the model to potentially dangerous actions taken based on
the model’s output.
Data Poisoning (cont.)
• The following are some tools and techniques that can be used in the prevention and
mitigation of data poisoning attacks:
Data quality controls
Data monitoring
Outlier detection
Model validation and testing
Data preprocessing
Access controls
Regular software updates
Input validation
Principle of least privilege
Privilege
Escalation
Privilege escalation is simply any action that
enables a user to perform tasks they are not
normally allowed to do.
Privilege Escalation
• Every single configuration element for the Windows operating system is contained in its
registry. The registry is the central repository database for all configurations settings in
Windows, whether they are simple desktop color preferences or networking and
security configuration items.
• The registry is the most critical portion of the operating system, other than its core
executables.
• It is one of the first places an analyst goes to look for issues, along with the log files, if
Windows is not functioning properly, or if the analyst suspects the operating system
has been compromised.
• The Windows registry is a hierarchical database, which is highly protected from a
security perspective. Only specific programs, processes, and users with high-level
Windows Registry
Hives
The five hives are shown in the
attached image.
Although the registry stores all
configuration details for the Windows
operating system and installed
applications, configuration changes
routinely are not made to the registry
itself. They are usually made through
other configuration utilities that are
part of the operating system and its
applications. For instance, you would
not make changes to group policy
directly in the registry; you would
simply use the group policy editor,
which would update the registry.
Linux Configuration Settings
Infrastructure
Software as a Platform as a as a Service
Service (SaaS) Service (PaaS) (IaaS)
Google Apps, Dropbox, AWS Lambda, Microsoft DigitalOcean, Linode,
Salesforce, Office 365, Azure, Google App Rackspace, AWS, Cisco
iCloud, are all examples Engine, Apache Stratos, Metapod, Microsoft
of SaaS. AWS Elastic Beanstalk, Azure, Google Compute
Heroku. Engine (GCE)
Software as a
Service
• SaaS allows users to connect to and
use cloud-based apps over the
Internet.
• Organizations access applications and
functionality directly from a service
provider with minimal requirements
to develop custom code in-house.
• The vendor provides the service and
all of the supporting technologies
beneath it.
• Any security problems that arise
occur at the data-handling level.
• The most common types of SaaS
vulnerabilities exist in one or more of
three spaces: visibility, management,
Platform as a
Service
• PaaS provides customers a complete
cloud platform for developing, running
and managing applications without the
cost, complexity and inflexibility that
often comes with building and
maintaining that platform on premises.
• PaaS solutions are optimized to provide
value focused on software
development.
• PaaS is designed to provide
organizations with tools that interact
directly with what may be the most
important company asset: its source
code.
• Service Providers assume the
Infrastructure as a
Service
• IaaS is internet access to 'raw' IT
infrastructure—physical servers, virtual
machines, storage, networking and
firewalls—hosted by a cloud provider.
IaaS eliminates cost and the work of
owning, managing and maintaining on-
premises infrastructure.
• The organization provides its own
application platform and applications.
• Remember that SaaS typically only
offers applications, PaaS generally
offers a configured host with the
operating system only, and IaaS usually
offers a base server on which the
organization installs its own operating
Security as a Service
• SECaaS is a cloud-based model for
service delivery by a specialized
security service provider. SECaaS
providers usually offer services such as
authentication, antivirus, intrusion
detection, and security assessments.
• SECaaS serves as an extension of MSSP
capabilities, providing incident
response, investigation, and recovery.
• Examples include; Identity and access
management, Antivirus management,
Data loss prevention (DLP), Continuous
monitoring, Firewall as a Service
(FWaaS), Vulnerability scanning.
Cloud Deployment Models