Understanding Preflight OPTIONS Requests: The CORS Gatekeeper

Browsers enforce the same-origin policy to prevent malicious cross-site requests. Preflight acts as a “handshake” before sensitive requests, asking: “Server, are you cool with this?” 🔥 Triggers for Preflight: Non-simple HTTP methods (PUT, DELETE, PATCH) Custom headers (e.g., X-API-Token) “Advanced” Content-Types (e.g., application/json) Credentialed requests (with cookies/auth) ✅ Simple requests (GET/POST with basic headers) skip preflight! 🔁 How Preflight Works: A 2-Step Dance sequenceDiagram Browser->>Server: OPTIONS Request (Preflight) Note left of Browser: Headers sent:<br>📍 Origin<br>📍 Access-Control-Request-Method<br>📍 Access-Control-Request-Headers alt Server Allows Server-->>Browser: 200 OK + CORS Headers Note right of Server: Headers returned:<br>✅ Access-Control-Allow-Origin<br>✅ Access-Control-Allow-Methods<br>✅ Access-Control-Allow-Headers Browser->>Server: Actual Request (e.g., DELETE) else Server Denies Server-->>Browser: CORS Error Blocked! end ⚙️ Server-Side Setup Essentials Handle OPTIONS requests correctly: ...

October 21, 2025 · 2 min · 309 words · 0xuki

Source to Sink: Core Penetration Testing Approach

🎯 1. Investigating Blind Spots in Authenticated Areas 🚩 Source: Parameters in authenticated functionality ⚠️ Sink: Privileged operations user_id = request.form['user_id'] # 🚩 Source db.execute(f"DELETE FROM users WHERE id = {user_id}") # ⚠️ Sink 🔗 Attack Flow: Source → Privilege bypass → Sink 🧼 2. Input Sanitization Analysis 🚩 Source: User input fields ⚠️ Sink: Rendering functions const userComment = req.body.comment; // 🚩 Source const sanitized = userComment.replace('<script>', ''); // 🛑 Vulnerable res.send(`<div>${sanized}</div>`); // ⚠️ Sink 🔗 Attack Vector: Source → Weak sanitization → Sink ...

June 6, 2025 · 2 min · 326 words · 0xuki

DIRB

Exploring the DIRB Command on Kali Linux: A Comprehensive Guide for Web Penetration Testing In the realm of web penetration testing, the ability to discover hidden or obscure resources on a web server is a critical skill. This is where the DIRB command comes into play, especially within the environment of Kali Linux, a preferred operating system among security professionals and ethical hackers. This blog post delves into the functionality of the DIRB command, illustrating its importance and providing practical guidance on how to effectively utilize this powerful tool. ...

January 4, 2025 · 3 min · 550 words · 0xuki

Understanding Servlet Mappings

Servlet Mappings Made Simple: A Beginner’s Guide Servlet mappings are a fundamental concept in Java web development. They define how requests from a web browser are directed to specific servlets on a server. Think of servlet mappings as traffic signs on a highway—they guide incoming requests to the right destination for processing. What is a Servlet? A servlet is a Java program that runs on a server and handles client requests. For example, it might process form data, interact with a database, or generate dynamic web pages. ...

December 21, 2024 · 2 min · 320 words · 0xuki

HTTP Request Smuggling (HRS)

Understanding HTTP Request Smuggling: A Deep Dive into Web Security In the dynamic world of web security, new threats and vulnerabilities continuously emerge, challenging the robustness of our digital infrastructures. Among these, HTTP request smuggling stands out as a complex yet intriguing exploit that targets the very foundations of how the web operates. This blog post aims to unravel the complexities of HTTP request smuggling, exploring its mechanisms, potential impacts, and effective countermeasures to safeguard against this sophisticated cyber threat. ...

April 20, 2024 · 3 min · 597 words · 0xuki

Cross-Origin Resource Sharing (CORS)

Understanding Cross-Origin Resource Sharing (CORS): A Beginner’s Guide In the world of web development, security is paramount. One crucial aspect of securing web applications is understanding how to manage Cross-Origin Resource Sharing, commonly known as CORS. This concept can be a bit daunting for beginners, so in this blog post, we’ll break down CORS in a way that’s easy to understand and implement. What is CORS? CORS is a security feature implemented by web browsers to prevent malicious websites from accessing resources from another domain without permission. Essentially, it allows web servers to define who can access their resources and how. It’s a policy used to relax the same-origin policy, which is a security measure that restricts how a document or script from one origin can interact with resources from another origin. ...

April 13, 2024 · 3 min · 597 words · 0xuki

CSRF Cross Site Request Forgery

Cross-Site Request Forgery (CSRF) What is CSRF? Cross-Site Request Forgery (CSRF) is a type of attack that forces a logged-in user to perform unwanted actions on a web application. The attacker tricks the user into submitting a malicious request to the web application, which the application then executes as if it were coming from the legitimate user. How does CSRF work? There are two main ways that CSRF attacks can be carried out: ...

April 1, 2024 · 2 min · 362 words · 0xuki

CSRF Tokens

CSRF Tokens: A Comprehensive Guide for Security Professionals Introduction Cross-Site Request Forgery (CSRF) is a malicious attack that tricks a user’s browser into performing unintended actions on a trusted website where the user is logged in. This can lead to unauthorized data access, financial losses, and other serious consequences. How CSRF Attacks Work: Victim logs in: The victim logs into a trusted website (e.g., a bank) and their browser stores a session cookie. Attacker creates a malicious link or form: The attacker creates a link or form on a different website (e.g., a website they control or a compromised ad). Victim visits the attacker’s site: The victim is tricked into visiting the attacker’s website or clicking on the malicious link. Victim’s browser sends the cookie: When the victim interacts with the attacker’s website (e.g., clicking a link or submitting a form), their browser unknowingly sends the session cookie for the trusted website along with the request. Attacker leverages the cookie: The attacker’s website receives the victim’s session cookie and includes it in a request to the trusted website. Since the website sees a valid cookie, it assumes the request is coming from the legitimate user and performs the action embedded in the attacker’s request. What is a CSRF Token? ...

March 21, 2024 · 3 min · 475 words · 0xuki