Stored Cross-Site Scripting Attack (Persistent)
(G, H, D-2)
Goal: Inject malicious code into data stored on a server (DB, comment, forum)
How:
1. attacker’s entry point is anywhere input is saved on the server: db, file, message board, blog comment, etc.
Defend:
as text, not code
Reflected Cross-Site Scripting Attack (G, H, D-2)
Goal: trick a victim into running malicious script from a deceptive link or form.
How: malicious script embedded in a link or form, but not stored; executed (reflected) immediately from server response. in the form of search results, error messages, etc. hits one user at a time
Defend:
Cross-Site Scripting Attack: DOM-based (G, H, D-)
goal: exploit insecure javascript in the browser’s DOM.
how: page’s javascript takes untrusted input (eg url fragment) and writes it into the page without sanitizing.
Defend:
2 CSP (content security policy) -> blocks unauthorized scripts
both prevent browser from executing injected client-side scripts
Replay Attack (define) (G, H, D-2)
Goal:gain unauthorized access
How: attacker captures valid network traffic (eg login request, session token) and resends (replays) it to trick system)
Defend:
1) session tokens: use session tokens with timestamps/nonces so captured traffic can’t be reused since it expired or is only valid once
2) Encryption (TLS) bc it makes capturing valid credentials/tokens much harder
Pass the Hash (G H D-3)
Goal: authenticate to a system without authorization
How: attacker steals a hashed (not plaintext) password from memory or a file and reuses it to authenticate to another system
Defend:
1) MFA: even if the hash is stolen, attackers still need second factor
2) disable NTLM/use Kerberos & modern authentication to reduce/eliminate reliance on reusable password hashes
3) limit credential exposure by restricting admin rights/isolating accounts. fewer high-value hashes available to steal
Directory Traversal (G H D-4)
goal: gain access to files on the web server outside of the target site’s home directory
how: usually happens thru web urls or web app input by manipulating filepaths. clue is /…/…/…/etc/passwd to access files outside intended directory
defend (4)
1) input validation: block /%3e%2e/../..etc, or other path traversal sequences. prevents attackers from escaping allowed directory
2) whitelists for file access: allow only specific, approved filenames/directories. works bc even if traversal succeeds, restricted permissions limit damage.
3) run apps with least privilege: even if traversal succeeds, restricted permissions limit damage
4) canonicalization/normalize paths: convert paths to a standard form before using them. this removes sneaky encodings (%2e=. and %2f = /)that bypass filters looking for /../
Cross-Site Request Forgery (G, H, D-5)
goal: trick a logged-in user’s browser into sending a malicious request to a trusted site (bank, shopping, email, etc). attacker wants victim’s session/cookies to perform unauthorized actions (money transfer, password change)
how:
1. user logs into trusted site eg mybank.com, which authenticates by sending them a cookie
2. attacker lures them to http://attacker.com with malicious link containing CSRF
3. user clicks it, thereby sending forged request as if it were them to mybank.com
4. attacker piggybacks on the authenticated session & sends fraudulent requests (eg send money to offshore account)
defend:
1) use anti-CSRF tokens, unique to each form/request. attacker’s site can’t know secret token so forged requests fail
2) SameSite Cookies: mark session cookie with samesite=strict so they’re not sent in cross-site requests. prevents browser from attaching cookies to attacker’s forged requests.works bc CSRF relies on the browser automatically including your session cookies. samesite prevents browser from sending them when erquest originates from another site
3) user interaction checks: re-authentication for critical actions
4) least privilege accounts: separate admin and users. limit damage i CSRF hits a regular account
5) verify HTTP referers: server checks referer header in incoming requests to confirm origin domain. blocks requests from external untrusted sites (older, weaker defense)
Mobile Devices: SMS & MMS risk
risk: can deliver malwre
Mobile Devices: Camera Use risk
sensitive data can be photographed— camera use often restricted or disabled as a best practice
Mobile Devices: Jailbreaking
iOS only: bypassing apple’s app store and security controls
Goal: install unauthorized apps and remove system restrictions
Mobile Devices: Rooting
android only: gaining access to the root (admin) account, undermining device security and MDM controls
Mobile Devices: Sideloading
loading an app directly onto your mobile divce from a computer, bypassing the app store
Mobile Devices: 3rd-party app risk
risk: apps may be unregulated, poorly validated, and more likely to contain malware
Vulnerabilities: Cryptographic ( goal, definition)
Supply Chain Attack (G H D)
Goal: compromise hardware, software, or services before they reach the target so they’re already infected/backdoored
How: attacker compromises a vendor, manufacturer, or update system. malicious component (code, driver, library, firmware) added to product. organizations then install/use it, giving attacker foothold
Defend:
1) code signing/digital signatures: verify origin of software updates. prevent tampered software
2) vendor risk management/3rd party assessments: vet suppliers’ security practices before trusting to reduce risk of inheriting infection
3) software bill of materials (SBOMs): track all components and libraries in use to make it easier to detect malicious/vulnerable dependencies
4) network segmentation, monitoring, & least privilege: limit where 3rd party software/svcs can run to contain dmg. monitor too
Vulnerabilities: Hardware
data can be stolen via malicious cabeles, usb, cameras, etc
Defend: restric tphysical access to a system
Vulnerabilities: OS - Malicious libraries
attackersadd malicious code to a library that your software loads and runs. code and potentially malware executes unknowingly.
Vulnerabilities: OS - Malicious drivers
OS must trust drivers to function, making them hard to detect.
Defed: use code signing and restrict driver installation
Driver
Software that communicates with hardware
Vulnerabilities: Misconfiguration
when a system/component is set up wrong or insecurely eg unnecessary softwae, default credentials
Vulnerabilities: Zero Day
a vulnerability that creators/users don’t know exists yet. if exploited there’s no fix. Mitigate with layered controls
SQL Injection Attack
Goal: trick a web app into running malicious SQL commands against its database in order to read/modify/delete data: usernames, pws, cc #s
How: sql code into input field that, in the backend, is usually the input in a sql query ‘select * from users where username =’user_input’
since 1=1 is always true, so attacker can bypass login (i guess it authenticates on true/false?)
Defend:
1) parametereized queries (best defense) keep user input separate from sql code so input is treated as data, not executable sql
2) stored procedures: use predefined database routines instead of building queries w user input
3) input validation/whitelisting: only allow expected characters, eg no quotes/semicolons
4) least privilege for database accounts: app connects with minimal rights
5) error handling (dont expose DB errors) defend: show generic error msgs, not raw sql errors to prevent attackers from learning DB structure santizie inputs, WAFs, query parameters
6) WAF: filters and blocks malicious sql payloads (common injection patterns) before they reach the database. but doesn’t replace secure coding!
Malware: Logic Bomb
Goal: execute a malicous action when a specific condition is met; often as sabotage
How: embedded in legit software, triggers upon a specific condition eg certain employee fired or on a specific date
Defend:
4) behavior monitoring: can watch for unusual system or application behavior
Malware: Spyware
covertly monitors user activity/collects sensitive info like screenshots, network traffic, webcam/mic access
How: installed w.o user’s knowledge: bundled in ree software, malicious email attachment, drive-by download
Defend:
1) antivirus/anti-spyware: detects/ removes before it can steal data
2) application control(allowlisting): prevents unauthorized spyware from ever executing
3) patch management: keeping apps and OS updated, which removes vulnerabilities that spyware uses to install itself
4) user awareness/safe downloading practices (primary infection vector)
5) least privilege: run users w.o admin rights; limit’s spyware’s ability to install/persist