Let's start by explaining common attacks and how they work.
SQL is a language to search a database. By abusing SQL injection, attackers can force the database to show more data than usual. This could include stuff like passwords.
SQL injection works by abusing "comments" and a special command "1=1".
It needs 2 parts (look for these on your exam):
1) The command 1=1, which means yes.
2) A comment symbol. This is usually #, ' or --
So together, an attack looks like this. This command tells the server to give us every password, and ignore all errors:
SELECT * FROM passwords WHERE username = * OR 1=1#
Here are some examples of SQL injection for the exam. Try to spot the "1=1" part, and the comment sign which is #, ', or --
Cross-Site Scripting (XSS) is when the attacker injects (uploads) malicious JavaScript code into the website. When the user visits the website, the malicious code will execute in their browser.
Tip: reflected XSS is sending a link to the victim. Stored XSS is uploading a file or data into a website where other users could see it.
Reflected XSS
Reflected is just a way of saying the attack runs instantly. Because it's like looking in a mirror - you see something immediately.
The attacker sends a malicious link to their victim. This link has a hidden script to some malware. For example:
www.link-to-real-site.com[script]malware.exe[/script]
When the user visits the link, the malware.exe attacks their browser instantly. This is Reflected XSS.
Stored XSS
Stored means the attacker uploads the malicious JavaScript command to the website.
The attacker enters malicious commands in any text area on a website. This could include a login box, a search box, a comment section on YouTube, etc. It could also be an upload form that lets you upload attachments.
For example, instead of searching for the name of a song, the attacker writes [script]malware.exe[/script] in the search box.
When the attacker hits enter, or presses search, the malware gets stored in the website database. Then it could affect other users or the server.
A buffer is a temporary amount of memory on a website. A buffer has a fixed size. The amount of memory is decided by the programmer.
For example, imagine a text box on a website: "Please enter your age". Normal values for visitor ages are like 16-99 years old. So maybe the buffer size is 0-100. (It can take up to 3 characters from 0 to 100).
A buffer overflow is when the attacker uses a special technique to enter too much data, more than the size of the buffer. For example, "Please enter your age from 0-100" and the attacker enters "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" instead of a number from 0-100. This value is too big for the buffer.
What's the problem? The server gets confused. It doesn't know how to handle this input. So it accepts "arbitrary commands". Arbitrary command execution just means the server will obey ANY orders from the attacker. This can give complete control over the server.
An important fact to know: only some languages are vulnerable to buffer overflows. We will discuss this more later.
A "replay attack" just means stealing credentials. But instead of stealing a plaintext password, the credentials are usually stored in a cookie.
When you visit a website, sometimes it has a feature: "Remember me on this device for 30 days" or something. We call this feature "Session Management" and it's very common for websites to remember your login details. When you use this feature, it makes a cookie in your browser with your credentials (this cookie is called a "session token").
If an attacker can intercept or steal this cookie, they can "replay" it. This just means loading it in their web browser. Then they can login to the same site you have access to, instantly. It can even bypass MFA sometimes.
To stop replay attacks, we set the "Secure Cookies" parameter on the web server.
There are two important types of DNS attacks. One happens on public DNS servers (DNS cache poisoning). One happens on your local machine (hosts file poisoning).
DNS poisoning (also called DNS cache poisoning)
The attacker sends fake DNS data to a public DNS server. Until this gets detected, visitors will be sent to the wrong (malicious) website. For example:
www.real-safe-website.com has an IP address of 1.1.1.1
The attacker poisons the DNS server to change the IP address to 2.2.2.2. The IP address 2.2.2.2 is linked to a malware site.
Now, when people visit www.real-safe-website.com, the DNS server points them to 2.2.2.2 instead. This leads to malware.
Hosts file poisoning
This is similar, it's just that the target is the hosts file on your local device, not a public DNS server. The hosts file is a record of websites and IP addresses on your device. When you visit a website address, both Windows and Linux always check the local "hosts" file FIRST, before they check public DNS records.
If the attacker can edit the contents of this hosts file, they can redirect you to malicious websites.
For example, your hosts file contains the data:
www.real-safe-website.com 1.1.1.1
This means when you visit www.real-safe-website.com it sends you to the IP address 1.1.1.1.
The attacker simply edits the host file to this:
www.real-safe-website.com 2.2.2.2
This means when you visit www.real-safe-website.com it sends you to the IP address 2.2.2.2, which is a malware server.
The best ways to stop web attacks are:
We will cover these in more detail later.
For DNS attacks, it's best to install "DNSSEC" or DNS Security Extensions. This adds digital signatures to DNS responses, so they can't be faked by attackers.
To stop replay attacks, we use "Secure Cookies".
To stop buffer overflows, we use a "memory safe"/"type safe" language. Some languages are safe from buffer overflows.
Finally, there is a useful site for developers to learn more about web security. You don't have to visit this site, but you could be asked the name on the exam. It's called OWASP, the Open Web App Security Project.
Input validation is checking that the input from users is correct before the server processes it. It makes sure that data from public users is safe and in the right format.
You don't need to know how input validation happens, but here are some examples:
Client-side vs. Server-side
Here is the most important point to know: Validation must happen on the server, never in the user's browser (client-side).
With server-side validation, the server decides if something is safe or correct. Attackers can't change that decision (unless they have full control over the server).
However, client-side validation can be bypassed in like 30 seconds by a skilled hacker. It is useless.
So why does client-side validation exist? It's fast. Client-side validation can be used in testing/demo websites where speed is important. But never for any secure website.
You don't need to know any coding for this exam, but here are some ways that developers make safe websites:
Using "memory safe" or "type safe" languages: These are programming languages that automatically stop buffer overflow attacks. Both "memory safe" and "type safe" mean the same thing. You don't need to know which languages, just remember "memory safe"/"type safe" = it stops buffer overflows.
Authentication & session management: Use strong, salted hashes for passwords. Enforce Multi-Factor Authentication (MFA). To stop replay attacks, use secure cookie handling. Cookies can have a setting called "Secure", which means they are encrypted and can't be stolen.
Error handling: Error messages on a website can give away really useful information to hackers. Avoid exposing sensitive system information in error messages.
Secure dependencies: This is a supply chain risk. Developers depend on something called "libraries". These are like small pieces of third-party software from other companies. They make development faster or easier. For example, it could be a plug-in feature for your website that lets you play videos from YouTube. These libraries could become outdated or infected by malware. Developers should scan their library files for malware regularly.one hacks them or tries to open them physically, they'll delete the keys.
There are three main types of software testing.
Peer review (human review, also known as pair programming): This is like separation of duties. Two programmers work on the code together. They can spot each other's mistakes.
Static Analysis (SAST, Static Analysis Software Testing): An AI software scans the website's code without running the app. It finds weaknesses and vulnerabilities in the code.
Dynamic Analysis (DAST, Dynamic Analysis Software Testing): An AI software tests the website while it is running. It can check stuff like input validation and injection attacks.
Finally...
All testing must be done in a testing environment, on a safe server.
What hashes are used in Windows?
Windows uses two hashing algorithms to store passwords:
Kerberos: this is modern and safe. It uses SHA to protect passwords.
NTLM: this is an old type of hash that can be cracked easily. Microsoft stopped using it in 2025, but many older versions of Windows still use NTLM hashes.
What is the attacker's goal in Windows?
The goal is to find a hash. If it's NTLM hash, we can crack it and reveal the plaintext password. However, even if we find a Kerberos hash, maybe we can't crack it, but we can still abuse it for certain attacks.
There are a few important places in Windows that hackers want to target.
LSASS - Local Security Authority Subsystem Service (lsass.exe): this is the main Windows process that authenticates users. It stores the user's current password hash and it also stores Kerberos tickets. Attackers can use special tools to steal things from it.
SAM - Windows Security Account Manager (SAM) is a database file that stores local user account passwords in a hashed format.
What is the difference between LSASS and SAM? SAM is only for local accounts. LSASS is for "domain joined" users (Active Directory).
If the attacker steals a hash, they can try to crack it first. They take the hash to their laptop (usually Kali Linux) and brute force it. This is called an "offline attack" because it happens off the network.
Even if the attacker can't crack the hash, they could still use it to login. Some Windows misconfigurations let attackers login with a hash. This is called a "pass-the-hash" attack.
There are two advanced techniques hackers use to stay "persistent" in Windows (keep long-term, stealthy access to the victim).
1) You might see questions about "DLL injection" or "process injection". This technique is just uploading malware into a safe, trusted process that is already running on the target. For example, I hack my boss's computer. My boss is using Excel.exe. I inject my malware into Excel.exe. Because Excel is already running, and it is trusted by Windows, my malware is less likely to be detected.
2) "Living off the Land" techniques. This means using tools that are already present on the target machine. These tools are trusted by Windows and they are digitally signed, so they are less suspicious. The attacker uses Windows tools to do their attack, so they don't need to upload malware (which could be detected). The most common tool in Windows is PowerShell. If you see a question with a PowerShell script, the attacker is usually trying to open an external connection to the internet, so they can steal files. We call that connection a "reverse shell".