<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mazen Elsayed on Medium]]></title>
        <description><![CDATA[Stories by Mazen Elsayed on Medium]]></description>
        <link>https://medium.com/@MazenElsayed_?source=rss-21fdea769808------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0pvDcL0ghEsBYTcfq0Jtfg.jpeg</url>
            <title>Stories by Mazen Elsayed on Medium</title>
            <link>https://medium.com/@MazenElsayed_?source=rss-21fdea769808------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:28:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MazenElsayed_/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Active Directory Lateral Movement: Techniques, Attack Paths, and Detection]]></title>
            <link>https://medium.com/@MazenElsayed_/active-directory-lateral-movement-techniques-attack-paths-and-detection-b1f22a0d9d37?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1f22a0d9d37</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 08:59:27 GMT</pubDate>
            <atom:updated>2026-10-27T08:59:27.972Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6qpaI4wZrI9u4WgGEdAk2g.png" /></figure><h3>Introduction</h3><p>In enterprise network attacks, compromising a single machine does not necessarily mean that an attacker has achieved their ultimate objective. In many cases, initial access is only the first step in a series of activities aimed at reaching additional systems, obtaining greater privileges, and accessing sensitive resources within the organization.</p><p>This phase is known as <strong>Lateral Movement</strong>, a set of techniques attackers use to move from a compromised machine or account to other systems or accounts within a network. In Active Directory environments, this movement may rely on valid credentials, administrative privileges, remote management services, or Windows authentication mechanisms.</p><p>Understanding lateral movement is essential in cybersecurity because it enables penetration testers to assess the potential impact of a compromise and helps defensive teams identify suspicious activity before it escalates into a broader domain compromise.</p><p>In this article, we will explore common lateral movement techniques in Active Directory environments, the prerequisites that make them possible, how to examine these techniques in an isolated lab, and the detection indicators and defensive measures that can help reduce their risks.</p><h3>Understanding Lateral Movement in Active Directory Environments</h3><p>Lateral movement occurs when an attacker uses existing access to interact with other systems within a network. Rather than focusing exclusively on the initially compromised machine, the attacker attempts to expand their reach by leveraging available privileges, usable credentials, or accessible network services.</p><p>In Active Directory environments, computers and servers communicate through various services and protocols, including SMB, Windows Remote Management (WinRM), and Windows Management Instrumentation (WMI). These technologies are legitimately used for system administration, file sharing, and remote task execution. However, an attacker with suitable credentials and sufficient permissions may abuse these mechanisms to access another machine.</p><p>The feasibility of lateral movement depends on several factors, including the type of compromised account, its associated privileges, access to remote services, authentication policies, and security configurations on the target systems. Therefore, network connectivity between two machines does not automatically mean that an attacker can move between them. The necessary authentication, access, and execution requirements must also be satisfied.</p><p>It is important to distinguish lateral movement from privilege escalation. Lateral movement involves transitioning between systems or accounts within an environment, whereas <strong>privilege escalation</strong> involves obtaining a higher level of permissions than the attacker initially possessed. These activities can occur independently or as part of the same attack chain. An attacker might move to another server using existing privileges and then attempt to escalate their privileges on that system.</p><p>For example, if an attacker gains access to a workstation through a standard user account, they may attempt to identify other systems accessible to that account. If the account has administrative privileges on a particular server, that server may represent a potential lateral movement path. If the attacker subsequently exploits a weakness in the server’s configuration to obtain greater privileges, that would constitute privilege escalation.</p><p>For this reason, securing Active Directory requires more than protecting the Domain Controller alone. Organizations must also review account permissions, administrative relationships between machines, remote access capabilities, and the ways credentials are stored and used. Weaknesses in any of these areas may allow an attacker to expand the impact of an initial compromise across the network.</p><h3>Prerequisites for Lateral Movement</h3><p>Before an attacker can move between systems in an Active Directory environment, certain conditions must allow them to use their existing access to interact with other machines. These prerequisites vary depending on the technique, network configuration, security policies, and permissions associated with the compromised account.</p><p><strong>1. Valid Credentials</strong></p><p>Credentials, such as usernames and passwords or other authentication material, play an important role in many lateral movement scenarios. If an attacker obtains usable credentials, they may attempt to authenticate to other systems that permit the account to access them. However, valid credentials do not automatically grant access to every machine in the domain, as access also depends on permissions and the applicable authentication policies.</p><p><strong>2. Administrative Privileges</strong></p><p>The permissions associated with an account directly influence the actions that can be performed on other systems. Some lateral movement techniques require local administrative privileges on the target machine, while other activities may be possible with a standard user account. Reviewing accounts that hold administrative privileges across multiple machines is therefore an essential step in reducing the risk of compromise spreading throughout the environment.</p><p><strong>3. Network Connectivity and Service Accessibility</strong></p><p>Even when suitable credentials are available, access to another machine may be blocked by firewall rules or network segmentation. Certain lateral movement techniques rely on services such as SMB, WinRM, or WMI, meaning that the relevant services must be reachable and configured to permit the required operations. Conversely, restricting unnecessary communication between systems helps reduce the paths available to an attacker.</p><p><strong>4. Remote Management Configuration</strong></p><p>Remote management tools provide administrators with essential capabilities, including server administration, command execution, and system monitoring without direct physical access. However, insecure configurations or allowing too many accounts to use these services can create opportunities for abuse. Organizations should enable only the remote management services they require, restrict access to authorized accounts and systems, and monitor the activities performed through these services.</p><p><strong>5. Authentication Policies and Credential Protection</strong></p><p>Authentication mechanisms and credential protection measures influence an attacker’s ability to reuse previously obtained access. Weak passwords, the reuse of accounts across multiple machines, and unnecessary privileges can increase the likelihood of successful lateral movement. Strong authentication, least-privilege access, credential protection, and monitoring for unusual authentication activity can help mitigate these risks.</p><p>Overall, lateral movement does not depend on a single factor. Instead, it results from a combination of conditions involving identities, permissions, network connectivity, services, and security configurations. Understanding these prerequisites makes it easier to analyze lateral movement techniques and identify the areas that should be tested and monitored when assessing the security of an Active Directory environment.</p><h3>Common Lateral Movement Techniques in Active Directory</h3><p>Several techniques can be used for lateral movement in Active Directory environments. Their feasibility depends on available privileges and the configuration of the target systems. Some of the most common techniques include:</p><p><strong>1. SMB and Administrative Shares</strong></p><p>SMB is used to share files and access network resources. Administrative shares, such as ADMIN$ and C$, may be abused to access other machines when the account being used has the necessary permissions.</p><p><strong>2. PsExec</strong></p><p>PsExec is used to run processes on remote Windows systems for administrative purposes. It may be abused for lateral movement when an attacker has credentials and permissions that allow remote execution on another machine.</p><p><strong>3. Windows Management Instrumentation (WMI)</strong></p><p>WMI provides an interface for managing Windows systems, querying system information, and performing certain administrative tasks. When the required permissions are available, it may be abused to execute operations remotely on other machines.</p><p><strong>4. Windows Remote Management (WinRM) and PowerShell Remoting</strong></p><p>These technologies enable administrators to manage Windows systems and execute PowerShell commands remotely. An attacker may abuse them if they obtain access to an account authorized to interact with the target systems.</p><p><strong>5. Pass-the-Hash (PtH)</strong></p><p>This technique involves abusing an NTLM password hash to authenticate without knowing the original password under certain conditions. Its success depends on authentication settings, permissions, and the security controls in place.</p><p><strong>6. Pass-the-Ticket (PtT)</strong></p><p>This technique involves abusing Kerberos authentication tickets to access other resources through an existing authentication context. It highlights the importance of protecting authentication tickets and monitoring unusual activity involving them.</p><p><strong>7. Credential Reuse and Exposed Credentials</strong></p><p>An attacker may benefit from credentials reused across multiple machines or credentials exposed through insecure storage or handling practices. This can increase the likelihood that a compromise on one machine will affect additional systems.</p><p>These techniques differ in their mechanisms and prerequisites, but they share a common characteristic: they can exploit legitimate access, credentials, or remote administration tools to expand the scope of a compromise. Organizations should therefore analyze activity in context, monitor authentication and administrative access, and enforce the principle of least privilege to reduce opportunities for abuse.</p><h3>Practical Lab Scenario: Investigating Lateral Movement in a Test Environment</h3><p>To understand how lateral movement works in practice, you can build an isolated test environment containing two Windows machines with predefined accounts and permissions. All experiments should be conducted only in an environment you own or are explicitly authorized to test.</p><p><strong>Step 1: Prepare the Lab Environment</strong></p><p>Set up one machine to represent the initial workstation and another to represent the target system. Verify network connectivity and enable the necessary security logging to record relevant activities.</p><p><strong>Step 2: Review Permissions</strong></p><p>Use a dedicated test account to examine the permissions assigned to it on the target machine. The goal is to understand how account permissions influence the ability to perform remote administrative tasks.</p><p><strong>Step 3: Examine Available Services</strong></p><p>Review the configurations of SMB, WMI, and WinRM to identify enabled services, accounts authorized to use them, and firewall rules governing access.</p><p><strong>Step 4: Monitor Events</strong></p><p>Perform legitimate, authorized administrative operations and examine Windows Security logs and relevant service logs. Look for information such as the account used, source machine, target machine, event timestamp, and type of activity.</p><p><strong>Step 5: Analyze the Results</strong></p><p>Compare recorded events with the expected behavior of the account. Observe how authentication and administrative access logs can help identify unusual activity, while recognizing that individual events may be legitimate and must be interpreted in context.</p><p>This scenario provides a foundation for understanding the prerequisites for lateral movement, the relationship between permissions and remote services, and the importance of collecting and analyzing logs. The exercise can later be expanded to investigate individual techniques within a controlled lab environment.</p><h3>Detection and Monitoring of Lateral Movement</h3><p>Detecting lateral movement is an essential part of securing Active Directory environments. Attackers may use valid accounts and legitimate administrative tools, making malicious activity difficult to distinguish from normal operations. Effective detection therefore requires analyzing events and correlating them with expected network behavior.</p><p><strong>1. Monitoring Windows Security Logs</strong></p><p>Windows Security logs help track logon activity, authentication attempts, and the use of privileges. Important events to monitor include:</p><ul><li><strong>Event ID 4624:</strong> A successful logon.</li><li><strong>Event ID 4625:</strong> A failed logon attempt.</li><li><strong>Event ID 4648:</strong> An attempt to log on using explicit credentials.</li><li><strong>Event ID 4672:</strong> Special privileges assigned to a logon session.</li></ul><p>These events can help identify unusual authentication patterns, particularly when correlated with the account involved, the source machine, the target system, and the event timestamp.</p><p><strong>2. Monitoring Remote Connections and Administrative Activity</strong></p><p>Unusual connections involving SMB, WMI, or WinRM, as well as administrative activity across many machines within a short period, may indicate potential lateral movement. However, these activities should be compared with normal administrative operations to reduce false positives.</p><p><strong>3. Using Sysmon</strong></p><p>Sysmon provides detailed records of system activity, including process creation, network connections, and certain system changes. Events such as process creation (Event ID 1) and network connections (Event ID 3), when configured for logging, can help correlate activity across systems. The visibility provided depends on the Sysmon configuration and logging policy.</p><p><strong>4. Correlating Events and Analyzing Behavior</strong></p><p>Detection becomes more effective when logs from multiple machines are collected and analyzed together using a Security Information and Event Management (SIEM) platform. For example, an administrative logon to a server may be normal, but repeated logons to several servers from a workstation that is not typically used for administration may warrant investigation.</p><p>Ultimately, detecting lateral movement depends not on a single event but on correlating authentication, network connections, administrative activities, and their timing. This approach helps defensive teams identify and investigate suspicious behavior before the impact of a compromise expands.</p><h3>Mitigation and Defense Against Lateral Movement</h3><p>Reducing the risk of lateral movement requires multiple security controls that limit an attacker’s privileges, protect credentials, and help detect suspicious activity early.</p><p><strong>1. Apply the Principle of Least Privilege</strong></p><p>Users and service accounts should receive only the permissions required for their responsibilities. Domain Admin accounts should not be used for routine activities, and administrative group memberships should be reviewed regularly.</p><p><strong>2. Protect Credentials</strong></p><p>Use strong, unique passwords and enable multi-factor authentication where supported. Avoid storing passwords in unprotected files or scripts. Administrative accounts should also be carefully managed to reduce credential exposure across multiple systems.</p><p><strong>3. Segment the Network and Restrict Remote Access</strong></p><p>Network segmentation helps limit an attacker’s ability to move between systems. Remote administration protocols such as SMB, WinRM, and RDP should be permitted only where necessary, with appropriate firewall rules restricting access between systems and network zones.</p><p><strong>4. Secure Administrative Workstations</strong></p><p>Dedicated administrative workstations should be used for privileged tasks, with administrative accounts separated from everyday user accounts. This reduces the risk of privileged credentials being exposed on ordinary user devices.</p><p><strong>5. Enable Logging and Continuous Monitoring</strong></p><p>Configure Windows auditing policies, collect relevant security logs, and monitor unusual logons, administrative activity, and connections between systems. SIEM and EDR solutions can help identify suspicious behavior and support incident response.</p><p><strong>6. Patch Systems and Respond to Incidents</strong></p><p>Applying security updates helps reduce exposure to known vulnerabilities. When suspicious activity is detected, investigate affected accounts and systems, contain compromised devices, and address the root cause before returning systems to normal operation.</p><p>Together, these measures reduce opportunities for lateral movement, limit the potential impact of a compromise, and improve an organization’s ability to detect and respond to attacks.</p><h3>Conclusion</h3><p>Lateral movement is an important stage of Active Directory attacks because it allows an attacker to move from one system to another using available credentials and permissions. These activities may rely on legitimate administrative tools, making them more difficult to detect without effective monitoring and analysis.</p><p>Understanding techniques involving SMB, PsExec, WMI, and WinRM, along with credential abuse, helps explain how lateral movement can occur in Windows environments. On the defensive side, applying the principle of least privilege, segmenting networks, protecting administrative accounts, and monitoring security events can reduce risk and improve the detection of suspicious activity.</p><p>Studying these techniques in an isolated, authorized lab provides practical insight into how attacks operate and how defenders can detect and mitigate them. Combining technical knowledge with effective security controls is essential for building more secure Active Directory environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1f22a0d9d37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Basics: A Complete Guide to Windows Domain Environments]]></title>
            <link>https://medium.com/@MazenElsayed_/active-directory-basics-a-complete-guide-to-windows-domain-environments-9b0478733fb8?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b0478733fb8</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[system-administration]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 13:46:32 GMT</pubDate>
            <atom:updated>2026-10-24T13:46:32.819Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*fWgUgqgPmCHT1gHbdNc1VA.jpeg" /></figure><h3>1. Introduction</h3><p>Active Directory (AD) is a core technology used in enterprise Windows environments to centrally manage identities, computers, and resources. Understanding its architecture and internal mechanisms is essential for system administration and cybersecurity.</p><p>This article explores Active Directory’s core components, architecture, authentication protocols, access control, and domain infrastructure.</p><h3>2. What Is Active Directory?</h3><p>Active Directory (AD) is a directory service developed by Microsoft to organize and manage identities, computers, and resources within a Windows domain environment.</p><p>It stores information about directory objects and provides centralized services that support authentication, administration, and access management across an organization’s network.</p><h3>2.1 Active Directory Domain Services (AD DS)</h3><p>Active Directory Domain Services (AD DS) is a Windows Server role that provides the directory infrastructure for a domain. It stores directory data and enables domain controllers to provide authentication and directory services to domain members.</p><h3>2.2 Core Functions of Active Directory</h3><ul><li><strong>Directory Management:</strong> Stores and organizes information about users, computers, groups, and other objects.</li><li><strong>Authentication:</strong> Supports verification of user and computer identities.</li><li><strong>Access Management:</strong> Works with Windows security mechanisms to control access to resources.</li><li><strong>Centralized Administration:</strong> Enables administrators to manage domain objects and apply organizational policies.</li></ul><h3>3. Workgroup vs. Domain</h3><h3>3.1 Workgroup</h3><p>A Workgroup is a peer-to-peer Windows environment in which each computer manages its own local accounts and security settings. There is no centralized Active Directory domain authority for managing identities across all computers.</p><h3>3.2 Domain</h3><p>A Domain is a logical administrative boundary in which users, computers, and other objects are managed through a centralized directory service. In an Active Directory domain, domain controllers provide directory and authentication services to domain members.</p><h3>3.3 Key Differences</h3><ul><li><strong>Account Management:</strong> Workgroups use local accounts, while domains support centrally managed domain accounts.</li><li><strong>Authentication:</strong> Workgroup authentication typically relies on local computer accounts; domain authentication can use domain credentials.</li><li><strong>Administration:</strong> Workgroups require management on individual computers, while domains support centralized administration through tools such as Group Policy.</li><li><strong>Resource Access:</strong> Both environments can share resources, but domain environments provide centralized identity management and can simplify access administration.</li></ul><p>A domain-joined computer can still have local accounts, and joining a domain does not automatically grant a user access to every domain resource.</p><h3>4. Active Directory Architecture</h3><p>Active Directory has a logical and physical architecture that organizes directory data, domain boundaries, and the servers responsible for providing directory services. Understanding these components explains how Windows domain environments are structured and managed.</p><h3>4.1 Domain Controller (DC)</h3><p>A Domain Controller is a server running Active Directory Domain Services (AD DS). It stores a copy of the domain directory database and provides services such as authentication and directory access. Multiple domain controllers can serve the same domain and replicate directory changes between them.</p><h3>4.2 Domain</h3><p>A Domain is a logical administrative boundary within Active Directory. It contains directory objects such as users, computers, and groups, and provides a scope for managing identities and applying domain-level policies.</p><p>Each domain has its own directory partition and domain controllers. Domains within the same forest share a common schema and configuration and can establish trust relationships.</p><h3>4.3 Tree</h3><p>An Active Directory Tree is a collection of one or more domains arranged in a contiguous DNS namespace. For example, corp.example.com and eu.corp.example.com can belong to the same tree because their DNS names form a continuous namespace.</p><h3>4.4 Forest</h3><p>A Forest is the highest-level logical structure in Active Directory. It contains one or more domains that share a common schema, configuration, and global catalog. A forest establishes the overall directory boundary within which its domains operate.</p><h3>4.5 Logical vs. Physical Structure</h3><ul><li><strong>Logical Structure:</strong> Includes forests, trees, domains, and organizational units (OUs), which organize directory objects and administration.</li><li><strong>Physical Structure:</strong> Includes domain controllers, network sites, and site links, which represent server locations and network connectivity.</li></ul><p>The logical structure defines how directory resources are organized, while the physical structure helps Active Directory account for network topology and replication.</p><h3>5. Active Directory Objects and Schema</h3><p>Active Directory stores information as directory objects. Each object represents an entity, such as a user, computer, or group, and contains attributes that describe it. The directory schema defines the object types and attributes that Active Directory supports.</p><h3>5.1 User Objects</h3><p>A user object represents an identity in the directory. It contains attributes such as the username, display name, and account settings. User accounts can be used for authentication and assigned permissions to access resources.</p><h3>5.2 Computer Objects</h3><p>A computer object represents a computer joined to an Active Directory domain. It stores identifying information about the computer and supports its participation in domain authentication and management.</p><h3>5.3 Group Objects</h3><p>A group object organizes users, computers, or other groups to simplify administration and permission assignment. Active Directory supports security groups, which can be used to assign access permissions, and distribution groups, which are primarily used for email distribution.</p><h3>5.4 Organizational Units (OUs)</h3><p>An Organizational Unit is a container used to organize directory objects within a domain. OUs support delegated administration and allow Group Policy Objects to be linked to specific parts of the directory.</p><h3>5.5 Attributes</h3><p>Attributes are properties that describe a directory object. For example, a user object may contain attributes such as sAMAccountName, userPrincipalName, and displayName. Different object classes support different attributes.</p><h3>5.6 Directory Schema</h3><p>The schema defines the object classes and attribute types that can exist in Active Directory. It specifies which attributes are available for each object class and the rules governing their use.</p><h3>5.7 Security Identifier (SID)</h3><p>A Security Identifier (SID) is a unique identifier used by Windows to identify security principals, such as users and groups. Windows security mechanisms use SIDs when evaluating access permissions; account names alone are not the underlying security identity.</p><h3>5.8 Distinguished Name (DN)</h3><p>A Distinguished Name uniquely identifies an object by describing its location in the directory hierarchy. For example:</p><p>CN=Mazen,OU=Employees,DC=corp,DC=example,DC=com</p><p>This DN identifies an object named Mazen inside the Employees OU in the corp.example.com domain.</p><h3>6. Active Directory Database and Storage</h3><p>Active Directory Domain Services stores directory information in a database and uses separate storage mechanisms for supporting files and domain policies. Understanding these components helps explain how directory data is maintained and distributed.</p><h3>6.1 The NTDS.dit Database</h3><p>NTDS.dit is the main database file used by Active Directory Domain Services on a domain controller. It stores directory objects and their attributes, along with other directory information required to operate the domain.</p><h3>6.2 Directory Partitions</h3><p>Active Directory organizes directory data into logical sections called partitions or naming contexts. The main partitions include:</p><ul><li><strong>Domain Partition:</strong> Contains objects belonging to a domain, such as users, groups, and computers.</li><li><strong>Configuration Partition:</strong> Stores forest-wide configuration information, including details about directory services and replication topology.</li><li><strong>Schema Partition:</strong> Defines the object classes and attributes supported by the directory.</li><li><strong>Application Partitions:</strong> Store application-specific directory data that can be replicated to selected domain controllers.</li></ul><h3>6.3 SYSVOL</h3><p>SYSVOL is a shared directory replicated between domain controllers in a domain. It stores domain-related files, including Group Policy files and scripts used by administrative processes.</p><h3>6.4 NTDS.dit vs. SYSVOL</h3><p>The main difference is their purpose: NTDS.dit stores structured directory data, while SYSVOL stores supporting files, including Group Policy content and scripts. They are separate components that serve different roles in Active Directory.</p><h3>7. DNS and Active Directory</h3><p>The Domain Name System (DNS) is a critical dependency of Active Directory. Domain-joined computers use DNS to locate domain controllers and discover services required for domain operations.</p><h3>7.1 Why DNS Is Important</h3><p>When a computer or user needs to interact with an Active Directory domain, the system must locate an appropriate domain controller. DNS provides the records that help clients discover these servers and their services.</p><h3>7.2 SRV Records</h3><p>Service (SRV) records identify servers that provide specific services. Active Directory uses SRV records to help clients locate domain controllers and related services.</p><p>For example, records associated with LDAP and Kerberos help clients discover servers supporting directory access and authentication.</p><h3>7.3 Domain Controller Discovery</h3><p>When a domain-joined computer needs a domain controller, Windows can query DNS for the appropriate service records. It then uses the discovered server to perform domain-related operations, depending on the task and available connectivity.</p><h3>7.4 DNS Names and Active Directory</h3><p>Active Directory domains commonly use DNS names, such as corp.example.com. DNS supports service discovery and name resolution, while Active Directory maintains directory objects, domain relationships, and identity information.</p><p><strong>Key takeaway:</strong> DNS helps domain members find the services they need; Active Directory provides the directory and domain-management functionality those services support.</p><h3>8. Active Directory Protocols</h3><p>Active Directory relies on several network protocols to support directory access, authentication, name resolution, and file sharing. Each protocol serves a different purpose within a Windows domain environment.</p><h3>8.1 LDAP (Lightweight Directory Access Protocol)</h3><p>LDAP is used to query and manage directory information. Applications and administrative tools can use it to search for users, groups, computers, and other directory objects.</p><ul><li><strong>LDAP:</strong> Commonly uses TCP port 389.</li><li><strong>LDAPS:</strong> LDAP protected by TLS, commonly using TCP port 636.</li></ul><h3>8.2 Kerberos</h3><p>Kerberos is a network authentication protocol and the primary authentication protocol in many Active Directory domain environments. It uses tickets to authenticate users and services without repeatedly transmitting the user’s password.</p><p>In a typical domain, the Key Distribution Center (KDC), running on a domain controller, helps issue authentication and service tickets.</p><h3>8.3 NTLM (NT LAN Manager)</h3><p>NTLM is a Windows authentication protocol that remains available for compatibility with certain systems and scenarios. It uses a challenge-response mechanism and may be used when Kerberos cannot be used or is not negotiated.</p><h3>8.4 DNS (Domain Name System)</h3><p>DNS resolves names and helps domain members discover services, including domain controllers. Active Directory relies heavily on DNS records to locate the servers needed for domain operations.</p><h3>8.5 SMB (Server Message Block)</h3><p>SMB supports network file and printer sharing. In Active Directory environments, it can be used to access shared folders and domain resources, including the SYSVOL share.</p><p>SMB commonly uses TCP port 445.</p><h3>9. Authentication in Active Directory</h3><p>Authentication is the process of verifying the identity of a user or computer. In Active Directory, domain controllers provide authentication services that allow domain members to establish their identities before accessing network resources.</p><h3>9.1 Kerberos Authentication</h3><p>Kerberos is the primary authentication protocol in modern Active Directory domain environments. It uses tickets to authenticate users and access services without repeatedly sending the user’s password across the network.</p><p>The Key Distribution Center (KDC), which runs on a domain controller, consists of two logical services:</p><ul><li><strong>Authentication Service (AS):</strong> Helps authenticate the user and issue a Ticket-Granting Ticket (TGT).</li><li><strong>Ticket-Granting Service (TGS):</strong> Issues service tickets that allow the user to authenticate to specific network services.</li></ul><h3>9.2 The Kerberos Authentication Process</h3><p>A simplified Kerberos authentication flow consists of these steps:</p><ol><li><strong>Initial Authentication:</strong> The client contacts the KDC to request authentication.</li><li><strong>TGT Issuance:</strong> After successful authentication, the client receives a Ticket-Granting Ticket (TGT).</li><li><strong>Service Ticket Request:</strong> When accessing a network service, the client presents its TGT to request a service ticket.</li><li><strong>Service Access:</strong> The client presents the service ticket to the target service, which validates it according to Kerberos rules.</li></ol><h3>9.3 TGT vs. Service Ticket</h3><ul><li><strong>Ticket-Granting Ticket (TGT):</strong> Used to request tickets for other services without repeating the initial authentication process.</li><li><strong>Service Ticket:</strong> Used to authenticate to a particular service, such as a file server.</li></ul><p>A TGT is not the same as a service ticket; each serves a different purpose in the Kerberos authentication process.</p><h3>9.4 NTLM Authentication</h3><p>NTLM is an alternative Windows authentication protocol that remains available for compatibility with certain environments and applications. It uses a challenge-response mechanism rather than the ticket-based process used by Kerberos.</p><p>Depending on the environment and connection, Windows may use NTLM when Kerberos is unavailable or cannot be negotiated.</p><h3>10. Authorization and Access Control</h3><p>Authorization determines which resources a user or computer is allowed to access after authentication. In Active Directory environments, access decisions rely on Windows security mechanisms, permissions, and security identities.</p><h3>10.1 Security Identifiers (SIDs)</h3><p>A Security Identifier (SID) uniquely identifies a security principal, such as a user or group. Windows uses SIDs to associate security permissions with identities rather than relying solely on account names.</p><h3>10.2 Security Tokens</h3><p>After a user logs on, Windows creates an access token containing security information about the user’s session. This includes the user’s SID and the SIDs of relevant groups, along with other security attributes.</p><p>Windows uses this token when evaluating access to protected resources.</p><h3>10.3 Access Control Lists (ACLs)</h3><p>An Access Control List (ACL) defines access rules associated with a securable object, such as a file or folder.</p><p>Two important types are:</p><ul><li><strong>Discretionary Access Control List (DACL):</strong> Contains access rules that determine which users or groups are allowed or denied specific actions.</li><li><strong>System Access Control List (SACL):</strong> Defines which access-related events can be audited.</li></ul><h3>10.4 Permissions and Group Membership</h3><p>Permissions can be assigned to individual users or security groups. Using groups simplifies administration because permissions can be managed for a group rather than configured separately for every user.</p><p>A user’s effective access depends on the resource’s security configuration, the user’s access token, and the applicable access-control rules.</p><h3>10.5 Authentication vs. Authorization</h3><p>Authentication establishes an identity, while authorization evaluates whether that identity has permission to perform a requested action. A successful domain logon does not automatically grant administrative privileges or access to every network resource.</p><h3>11. Group Policy (GPO)</h3><p>Group Policy is a Windows feature that enables administrators to centrally manage configuration settings for users and computers in an Active Directory domain. These settings are organized into Group Policy Objects (GPOs).</p><h3>11.1 What Is a Group Policy Object?</h3><p>A Group Policy Object (GPO) is a collection of configuration settings that can be applied to users or computers. GPOs can control Windows features, security settings, software configuration, and user environment options.</p><h3>11.2 Where GPOs Are Linked</h3><p>GPOs can be linked to three main levels within Active Directory:</p><ul><li><strong>Site:</strong> Applies policies to computers associated with a particular Active Directory site.</li><li><strong>Domain:</strong> Applies policies across the domain, subject to scope and filtering.</li><li><strong>Organizational Unit (OU):</strong> Applies policies to users or computers within a specific OU, subject to scope and filtering.</li></ul><p>GPOs are not linked directly to individual user or computer objects.</p><h3>11.3 Computer Configuration vs. User Configuration</h3><p>Each GPO contains two main sections:</p><ul><li><strong>Computer Configuration:</strong> Contains settings that apply to computers, regardless of which user signs in.</li><li><strong>User Configuration:</strong> Contains settings that apply to users, depending on policy scope and processing rules.</li></ul><h3>11.4 Group Policy Processing</h3><p>Windows processes applicable policies according to their scope, filtering, and precedence rules. In a typical domain environment, policies are processed in the following order:</p><p><strong>Local → Site → Domain → Organizational Unit (LSDOU)</strong></p><p>When multiple policies configure the same setting, precedence and specific processing rules determine the resulting configuration. Certain settings and options can affect the normal processing order.</p><h3>11.5 Managing Group Policy</h3><p>Administrators commonly use the Group Policy Management Console (GPMC) to create, link, and manage GPOs. Group Policy helps enforce consistent configurations across many domain-joined systems without configuring each computer individually.</p><h3>12. Replication and FSMO Roles</h3><p>Active Directory uses replication to distribute directory changes between domain controllers. It also assigns specific responsibilities to designated domain controllers through Flexible Single Master Operations (FSMO) roles.</p><h3>12.1 Active Directory Replication</h3><p>Replication is the process of synchronizing directory changes between domain controllers. When an administrator updates an object, such as a user account, the change is replicated to other relevant domain controllers according to the replication topology and schedule.</p><p>Replication helps maintain consistent directory information across the domain and forest.</p><h3>12.2 What Are FSMO Roles?</h3><p>Although many Active Directory operations can be performed by multiple domain controllers, some operations require a designated role holder to coordinate changes and avoid conflicts.</p><p>Active Directory has five FSMO roles:</p><p><strong>Forest-Level Roles</strong></p><ul><li><strong>Schema Master:</strong> Controls updates to the Active Directory schema.</li><li><strong>Domain Naming Master:</strong> Coordinates adding and removing domains within the forest.</li></ul><p><strong>Domain-Level Roles</strong></p><ul><li><strong>RID Master:</strong> Allocates pools of Relative Identifiers (RIDs) to domain controllers so they can create unique SIDs for security principals.</li><li><strong>PDC Emulator:</strong> Handles several important domain operations, including preferred password-change processing, account lockout coordination, and time-related functions.</li><li><strong>Infrastructure Master:</strong> Updates references to objects from other domains when those objects change.</li></ul><h3>12.3 Forest-Level vs. Domain-Level Roles</h3><p>The Schema Master and Domain Naming Master each exist once per forest. The RID Master, PDC Emulator, and Infrastructure Master each exist once per domain.</p><p>These roles can be hosted by the same domain controller or distributed across different domain controllers, depending on the environment’s design.</p><h3>13. Sites, Subnets, and Trust Relationships</h3><p>Active Directory uses sites and subnets to represent the physical network layout of an organization. Trust relationships allow identities in different domains to be recognized across domain boundaries, subject to the applicable permissions.</p><h3>13.1 Active Directory Sites</h3><p>An Active Directory Site represents one or more well-connected IP subnets. Sites help Active Directory account for the physical network topology when locating services and scheduling replication between domain controllers.</p><p>For example, an organization with offices in Cairo and Alexandria may configure separate sites for each location.</p><h3>13.2 Subnets and Site Links</h3><p>A subnet associates an IP address range with an Active Directory site. When a domain-joined computer determines its network location, this mapping helps Windows identify the appropriate site.</p><p>A site link represents a logical connection between sites and helps determine how intersite replication is scheduled.</p><h3>13.3 Trust Relationships</h3><p>A trust relationship allows one Active Directory domain to recognize authentication performed by another domain. Trust does not automatically grant access to resources; authorization and permissions are still required.</p><p>Common trust types include:</p><ul><li><strong>Parent-child trust:</strong> An automatically established, two-way, transitive trust between a parent domain and its child domain within a forest.</li><li><strong>Tree-root trust:</strong> An automatically established, two-way, transitive trust between domain trees in the same forest.</li><li><strong>External trust:</strong> Connects domains across separate forests or to certain legacy domains; it is generally non-transitive.</li><li><strong>Forest trust:</strong> Establishes a transitive trust between two forests, when configured, enabling supported cross-forest access.</li></ul><h3>13.4 Why These Components Matter</h3><p>Sites and subnets help Active Directory work efficiently across distributed networks. Trust relationships support collaboration across domain boundaries, while permissions determine which resources users can actually access.</p><h3>14. Domain-Joined Systems and Windows Logon</h3><p>A domain-joined computer is a Windows system that has established membership in an Active Directory domain. This enables centralized administration and allows domain users to authenticate using their domain credentials.</p><h3>14.1 The Computer Account</h3><p>When a computer joins an Active Directory domain, a computer object is created in the directory. This object represents the computer’s identity within the domain and supports secure communication between the computer and domain services.</p><p>Computer accounts typically have names ending with a dollar sign ($) when represented in certain Windows tools and directory attributes.</p><h3>14.2 Domain User Accounts vs. Local Accounts</h3><p>Windows computers can have both domain accounts and local accounts:</p><ul><li><strong>Domain Account:</strong> Managed through Active Directory and usable across domain-joined systems, subject to authentication and access policies.</li><li><strong>Local Account:</strong> Managed on an individual computer and primarily used to access that specific system.</li></ul><p>Joining a domain does not remove local accounts or automatically grant domain users administrative privileges.</p><h3>14.3 What Happens During Domain Logon?</h3><p>In a typical domain logon, Windows uses the following process:</p><ol><li>The user enters their domain credentials.</li><li>The computer locates an appropriate domain controller using domain discovery mechanisms, including DNS.</li><li>The domain controller validates the user’s identity through an available authentication protocol, commonly Kerberos.</li><li>After successful authentication, Windows establishes the user’s logon session and creates an access token.</li><li>Access to resources is determined by the applicable permissions and security policies.</li></ol><h3>14.4 Cached Domain Logons</h3><p>Windows can allow a user to sign in using previously cached domain logon information when a domain controller is unavailable, provided cached logons are enabled and the user has logged on successfully before.</p><p>A cached logon allows access to the local computer; it does not mean the computer has contacted a domain controller or that network resources are available.</p><h3>15. Service Accounts and Managed Identities</h3><p>Service accounts are identities used by applications, Windows services, and scheduled tasks to access resources or perform operations. In Active Directory environments, choosing the appropriate service account helps administrators manage permissions and authentication more effectively.</p><h3>15.1 What Are Service Accounts?</h3><p>A service account provides an identity for a service or application rather than an individual user. Depending on its configuration, it can be granted the permissions required to access files, databases, or other network resources.</p><p>Service accounts should follow the principle of least privilege, receiving only the permissions needed for their intended tasks.</p><h3>15.2 Traditional Service Accounts</h3><p>Traditional service accounts are commonly created as regular domain user accounts and configured to run specific services or applications.</p><p>Their credentials and permissions require appropriate administration, including secure password handling and periodic review of assigned privileges.</p><h3>15.3 Managed Service Accounts (MSAs)</h3><p>Managed Service Accounts are Windows accounts designed to simplify service identity management. Windows manages their passwords, reducing the need for administrators to manually maintain service-account passwords.</p><p>A standalone Managed Service Account (sMSA) is generally intended for use on a single computer.</p><h3>15.4 Group Managed Service Accounts (gMSAs)</h3><p>A Group Managed Service Account (gMSA) extends managed service-account functionality to supported services running across multiple computers. Windows manages the account password, allowing authorized systems to use the account without administrators manually distributing its password.</p><p>gMSAs are useful for services that need a domain identity across multiple servers, such as certain application pools and scheduled workloads.</p><h3>15.5 Choosing the Right Account</h3><p>The appropriate account type depends on the application’s requirements and the systems on which it runs. Using managed service accounts where supported can reduce password-management overhead, while carefully scoped permissions help limit unnecessary access.</p><h3>16. Practical Administration and Troubleshooting</h3><p>Active Directory administration involves managing directory objects, verifying domain connectivity, inspecting authentication, and diagnosing configuration issues. Windows provides several built-in tools to support these tasks.</p><h3>16.1 Active Directory Administrative Tools</h3><ul><li><strong>Active Directory Users and Computers (ADUC):</strong> Used to manage users, computers, groups, and organizational units.</li><li><strong>Group Policy Management Console (GPMC):</strong> Used to create, link, and troubleshoot Group Policy Objects.</li><li><strong>Active Directory Administrative Center (ADAC):</strong> Provides a graphical interface for common directory-management tasks.</li><li><strong>Event Viewer:</strong> Helps administrators investigate authentication, directory-service, and system errors through event logs.</li></ul><h3>16.2 Useful PowerShell Commands</h3><p>PowerShell provides commands for inspecting domain information and managing directory objects. The Active Directory module is required for the Get-AD* commands.</p><pre># Display domain information<br>Get-ADDomain</pre><pre># Display forest information<br>Get-ADForest</pre><pre># Retrieve a user account<br>Get-ADUser -Identity username</pre><pre># List domain controllers<br>Get-ADDomainController -Filter *</pre><pre># Display the computer&#39;s domain membership<br>Get-CimInstance Win32_ComputerSystem |<br>    Select-Object Name, Domain, PartOfDomain</pre><p>Replace username with the appropriate account name.</p><h3>16.3 Connectivity and Group Policy Diagnostics</h3><p>The following commands help investigate common domain-related issues:</p><pre>ipconfig /all<br>nslookup -type=SRV _ldap._tcp.dc._msdcs.corp.example.com<br>nltest /dsgetdc:corp.example.com<br>gpupdate /force<br>gpresult /r</pre><ul><li>ipconfig /all displays network configuration, including DNS servers.</li><li>nslookup queries DNS for domain-controller discovery records.</li><li>nltest /dsgetdc requests information about a domain controller.</li><li>gpupdate /force requests a refresh of applicable Group Policy settings.</li><li>gpresult /r summarizes the Group Policy settings applied to the user and computer.</li></ul><p>Replace corp.example.com with your actual domain name. Some commands require domain connectivity or appropriate permissions.</p><h3>16.4 A Practical Troubleshooting Approach</h3><p>When investigating a domain issue, start by checking network connectivity and DNS configuration. Then verify domain-controller discovery, review relevant event logs, and inspect authentication or Group Policy results as appropriate.</p><p>A structured troubleshooting process helps isolate the source of an issue before making configuration changes.</p><h3>17. Conclusion and References</h3><h3>Conclusion</h3><p>Active Directory is a fundamental technology for managing identities, computers, and resources in Windows domain environments. Understanding its architecture, directory objects, authentication protocols, access control mechanisms, Group Policy, and replication provides a strong foundation for learning enterprise Windows administration and cybersecurity.</p><p>These concepts also help readers understand how domain environments operate before exploring more advanced topics in Active Directory security.</p><h3>References</h3><ol><li><a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/virtual-dc/active-directory-domain-services-overview">Active Directory Domain Services Overview — Microsoft Learn</a></li><li><a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/replication/active-directory-replication-concepts">Active Directory Replication Concepts — Microsoft Learn</a></li><li><a href="https://learn.microsoft.com/en-us/windows-server/security/kerberos/kerberos-authentication-overview">Kerberos Authentication Overview — Microsoft Learn</a></li><li><a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/group-policy/group-policy-overview">Group Policy Overview — Microsoft Learn</a></li><li><a href="https://learn.microsoft.com/en-us/powershell/module/activedirectory/">Active Directory PowerShell Module — Microsoft Learn</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b0478733fb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Cache Poisoning: Understanding, Detecting, and Exploiting Cache Vulnerabilities]]></title>
            <link>https://medium.com/@MazenElsayed_/web-cache-poisoning-understanding-detecting-and-exploiting-cache-vulnerabilities-6d2694a84385?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d2694a84385</guid>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[web-cache-poisoning]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Sun, 04 Oct 2026 23:05:46 GMT</pubDate>
            <atom:updated>2026-10-04T23:05:46.614Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6SKe8ckHRwe8YjnTZNc8Cw.jpeg" /></figure><h3>Introduction</h3><p>Web applications rely heavily on caching to improve performance and reduce the load on backend servers. By storing responses and serving them to subsequent users, caches can significantly speed up the delivery of web content.</p><p>However, caching can also introduce security vulnerabilities when the cache and the backend application do not process requests in the same way.</p><p>One of these vulnerabilities is <strong>Web Cache Poisoning</strong>, where an attacker manipulates a response and causes the cache to store it. If successful, the poisoned response can then be served to other users who request the same resource.</p><p>In this article, we will explore how Web Cache Poisoning works, how to identify vulnerable behavior, and how these vulnerabilities can be exploited and prevented.</p><h3>What is Web Cache Poisoning?</h3><p>Web Cache Poisoning occurs when an attacker is able to influence a response that is stored by a web cache. Normally, a cache stores a response to a request and later reuses that response for other requests considered equivalent.</p><p>The problem appears when the cache decides that two requests are equivalent based on only part of the request, while the application processes additional parts of it. If an attacker can modify one of these ignored inputs and influence the generated response, the cache may store that manipulated response.</p><p>Once the malicious response is cached, other users requesting the same resource may receive it. This makes the vulnerability particularly interesting because the attacker is not necessarily targeting a single request or user — the poisoned response can potentially affect everyone who receives the cached content.</p><h3>How Web Caching Works</h3><p>To understand Web Cache Poisoning, we first need to understand how a web cache decides whether it can reuse a stored response.</p><p>When a user sends a request, the cache checks whether it already has a response for that request. If a matching cached response exists, the cache can return it directly without contacting the backend server. Otherwise, the request is forwarded to the application, and the resulting response may be stored in the cache.</p><p>The important concept here is the <strong>cache key</strong>. The cache key is the information used by the cache to determine whether two requests should receive the same cached response. Depending on the cache configuration, this may include the HTTP method, hostname, URL path, and query parameters.</p><p>The security problem begins when the application uses information that is <strong>not included in the cache key</strong> to generate its response. These inputs are commonly referred to as <strong>unkeyed inputs</strong>.</p><p>If an attacker can control an unkeyed input and use it to influence the response, they may be able to create a response that the cache considers valid for other users as well.</p><h3>Understanding Cache Keys and Unkeyed Inputs</h3><p>The <strong>cache key</strong> is one of the most important concepts in Web Cache Poisoning. It determines which parts of a request the cache uses to identify a stored response.</p><p>For example, a cache might use the following components:</p><pre>GET /products?id=10<br>Host: example.com</pre><p>If the cache key is based on the host, path, and query string, changing the value of an unrelated HTTP header may not create a new cache entry. However, the backend application may still process that header and use it when generating the response.</p><p>This creates a difference between what the <strong>cache considers important</strong> and what the <strong>application considers important</strong>.</p><p>An input that affects the application’s response but is ignored by the cache when creating the cache key is called an <strong>unkeyed input</strong>.</p><p>These inputs are especially interesting during security testing because an attacker may be able to manipulate them, influence the response, and then cause the resulting response to be cached.</p><p>The key question when testing for Web Cache Poisoning is therefore:</p><p><strong>Can I control an input that changes the response without changing the cache key?</strong></p><h3>Detecting Web Cache Poisoning</h3><p>The first step when testing for Web Cache Poisoning is to determine whether the response is actually being cached.</p><p>A useful indicator is the presence of cache-related headers such as X-Cache, Age, Cache-Control, or headers provided by a CDN. Sending the same request multiple times can also help determine whether the response is being served from the cache.</p><p>Once caching is confirmed, the next step is to look for inputs that influence the response but may not be included in the cache key. HTTP headers are particularly interesting because some applications use them to construct URLs, generate links, determine the host, or change other parts of the response.</p><p>For example, if changing a specific header modifies the response while the cache continues to treat the request as the same cache entry, this may indicate a potential poisoning condition.</p><p>However, simply finding an unkeyed input is not enough. You also need to verify that the modified response can actually be stored and subsequently delivered to other requests. This distinction is important because not every unusual response behavior leads to a practical cache poisoning vulnerability.</p><h3>Exploiting Web Cache Poisoning</h3><p>After identifying an unkeyed input that can influence the response, the next step is to determine whether it can be used to poison the cache.</p><p>The basic idea is straightforward: an attacker sends a request containing a malicious value in the unkeyed input. If the application reflects or otherwise uses that value in its response, and the response is considered cacheable, the cache may store the manipulated response.</p><p>For example, imagine an application uses a request header to generate an absolute URL inside its response:</p><pre>GET / HTTP/1.1<br>Host: example.com<br>X-Forwarded-Host: attacker.example</pre><p>If the application uses the X-Forwarded-Host value when generating the response, while the cache does not include this header in its cache key, the resulting response could potentially be stored under the normal cache entry.</p><p>The important part of the test is verifying the complete flow:</p><p><strong>Attacker-controlled input → Modified response → Cached response → Response served to another request</strong></p><p>A successful attack therefore depends on both the application’s behavior and the cache’s behavior. If either side prevents the manipulated response from being stored or reused, the poisoning attempt will fail.</p><h3>Impact of Web Cache Poisoning</h3><p>The impact of Web Cache Poisoning depends on what the attacker can influence in the cached response.</p><p>In some cases, the vulnerability may have a relatively limited impact, such as modifying links or loading resources from an attacker-controlled domain. In more serious scenarios, cache poisoning can be chained with other vulnerabilities, such as <strong>Cross-Site Scripting (XSS)</strong>, to execute malicious JavaScript in the browsers of other users.</p><p>Another important factor is the scope of the cache. If a poisoned response is stored in a shared cache, the attack may affect multiple users rather than only the attacker. This can turn a seemingly small input manipulation into a vulnerability with significant impact.</p><p>Therefore, when assessing Web Cache Poisoning, it is important to consider not only whether the cache can be poisoned, but also <strong>who can receive the poisoned response and what that response can do</strong>.</p><h3>Prevention and Mitigation</h3><p>Preventing Web Cache Poisoning requires keeping the caching behavior consistent with the way the application processes requests.</p><p>One important step is to make sure that any input capable of changing a response is properly considered when constructing the cache key. Applications should also avoid trusting user-controlled headers when generating security-sensitive or cacheable content.</p><p>Caching should be configured carefully, especially for responses that contain user-specific or dynamic information. Responses that should not be shared between users should generally not be stored in a shared cache.</p><p>Finally, developers and security teams should test the interaction between the application and the caching layer rather than analyzing them independently. A secure application can still become vulnerable if a reverse proxy, CDN, or other caching component interprets requests differently from the backend.</p><p>By controlling which responses are cached, correctly defining cache keys, and avoiding unsafe trust in user-controlled inputs, the risk of Web Cache Poisoning can be significantly reduced.</p><h3>Conclusion</h3><p>Web Cache Poisoning is a good example of how security issues can arise from the interaction between different components of a web application.</p><p>The key to understanding this vulnerability is recognizing the difference between what the application uses to generate a response and what the cache uses to identify that response. When an attacker can control an input that affects the response but is ignored by the cache key, a poisoning condition may become possible.</p><p>For security testers, understanding cache behavior, identifying unkeyed inputs, and verifying whether manipulated responses can be stored and served to other users are the most important steps when testing for this vulnerability.</p><p>For developers, correctly defining cache keys, handling user-controlled inputs safely, and carefully configuring shared caching can help prevent these attacks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d2694a84385" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Cache Deception: Understanding the Attack and How to Prevent It]]></title>
            <link>https://medium.com/@MazenElsayed_/web-cache-deception-understanding-the-attack-and-how-to-prevent-it-f9d617af56d3?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9d617af56d3</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[web-cache-deception]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Fri, 02 Oct 2026 22:18:20 GMT</pubDate>
            <atom:updated>2026-10-02T22:18:20.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSBHavP9I6gfeEQ7vRL7fQ.jpeg" /></figure><h3>Introduction</h3><p>Web applications rely heavily on caching to improve performance and reduce the load on backend servers. By temporarily storing responses, caches can handle repeated requests faster without requiring every request to reach the application server again.</p><p>However, caching can also introduce security risks when the cache and the backend application interpret URLs differently. This can lead to vulnerabilities such as <strong>Web Cache Deception</strong>.</p><p>Web Cache Deception occurs when an attacker tricks a caching layer into storing a sensitive, dynamically generated response that was intended only for an authenticated user. If the response is successfully cached, the attacker may later retrieve the cached content and access information belonging to the victim.</p><p>In this article, we will explore how Web Cache Deception works, how differences in URL interpretation can lead to the vulnerability, how to identify it during web security testing, and the key techniques developers can use to prevent it.</p><h3>What Is Web Cache Deception?</h3><p>Web Cache Deception is a security vulnerability that occurs when an attacker tricks a web cache into storing sensitive content from a web application. The core issue is a difference in how the URL is interpreted by the cache and the web application.</p><p>Web applications normally process certain URLs as dynamic requests, such as account pages or user-specific data. However, a cache may interpret the same URL as a request for a static resource that can be safely cached, especially when the URL contains an extension such as .css, .js, or .jpg.</p><p>An attacker can exploit this difference by crafting a URL that causes the application to return sensitive information while making the cache believe that the response is cacheable. If the response is stored, the attacker may later request the same URL and retrieve the data that was cached from the victim’s session.</p><p>Therefore, the core of Web Cache Deception is not simply the presence of a cache, but rather a <strong>mismatch in how different components of the system interpret the same URL</strong>.</p><h3>How Web Cache Deception Works</h3><p>To understand Web Cache Deception, it is important to first understand that a request to a web application may be handled by multiple components. In many architectures, a request passes through a cache or CDN before reaching the application server.</p><p>The vulnerability occurs when the cache and the backend interpret the same URL differently. For example, the application may treat /account as a dynamic page containing user-specific information, while the cache may interpret a URL such as /account/test.css as a static CSS resource because of the .css extension.</p><p>If the application does not properly validate the additional path segment, it may process /account/test.css in the same way as /account and return the same sensitive user-specific data.</p><p>At the same time, the cache may believe that the response represents a static resource and therefore store it. If the victim is authenticated when the request is made, the cached response may contain private information belonging to that victim.</p><p>The attacker can then request the same URL. Instead of receiving a fresh response from the application, the cache may return the previously stored response, potentially exposing information that was contained in the victim’s session.</p><p>Therefore, the attack relies on a chain of events: <strong>a URL interpretation mismatch → the request is processed as dynamic content → the response is cached → the cached data can potentially be retrieved later.</strong></p><h3>A Practical Example</h3><p>Suppose a web application contains a personal account page accessible through:</p><p>/account</p><p>When a user requests this page, the application returns information associated with their account. This information should not be shared through a common cache because it is specific to the authenticated user.</p><p>The attacker then attempts to access a path such as:</p><p>/account/test.css</p><p>If the backend ignores the /test.css portion and processes the request as /account, it may return the user&#39;s account information.</p><p>At the same time, if the cache uses the file extension to determine which resources can be cached, it may see .css and consider the response to be a static, cacheable resource.</p><p>If the victim visits this URL while authenticated, the response containing their information may be cached. The attacker can then request the same URL and potentially receive the cached response instead of a fresh response from the backend.</p><p>During a security assessment, Burp Suite can be used to monitor requests and responses and compare the behavior of the original URL with the modified URL. Headers such as Cache-Control, Age, and X-Cache can also provide useful indications of whether a response was cached or served from the cache.</p><h3>Web Cache Deception vs. Web Cache Poisoning</h3><p>Although Web Cache Deception and Web Cache Poisoning are both related to web caching, they represent different security problems.</p><p>In <strong>Web Cache Deception</strong>, the attacker attempts to make the cache store a sensitive response belonging to a specific user and then retrieve that cached content.</p><p>In <strong>Web Cache Poisoning</strong>, the attacker attempts to influence a response that will be stored in the cache so that other users later receive a manipulated or unintended response.</p><p>In other words, the main difference is the objective of the cache manipulation. Web Cache Deception focuses on <strong>exposing sensitive information that was incorrectly cached</strong>, while Web Cache Poisoning focuses on <strong>injecting unwanted content or behavior into a cached response</strong>.</p><h3>How to Test for Web Cache Deception</h3><p>During a web security assessment, the first step is to identify pages or endpoints that expose user-specific information, such as account pages, profiles, or certain API endpoints.</p><p>Next, the tester can examine how the application handles unexpected path segments or file extensions. For example, if the original endpoint is:</p><p>/account</p><p>different variations can be tested, such as:</p><p>/account/test.css</p><p>The responses can then be compared with the original URL.</p><p>If the application returns the same or sensitive content, the next step is to investigate the cache behavior. The request can be repeated while monitoring response headers to determine whether the response is being stored or served from the cache.</p><p>Testing with two separate accounts is also important because the key security question is whether one user can access a response that was previously cached from another user’s session.</p><h3>How to Prevent Web Cache Deception</h3><p>Preventing Web Cache Deception requires ensuring that the cache and backend handle URLs consistently.</p><p>First, responses containing personal or sensitive information should not be stored in a shared cache. Appropriate headers can be used, such as:</p><p>Cache-Control: private</p><p>or, when the content should not be stored at all:</p><p>Cache-Control: no-store</p><p>Second, cache rules should be carefully configured and should not rely solely on the presence of a file extension at the end of a URL to determine whether a response is cacheable.</p><p>Third, the backend should correctly handle unexpected paths. If /account is a dynamic endpoint, adding an arbitrary path such as /account/test.css should not result in the same sensitive content being returned in a way that allows the cache to interpret it differently.</p><p>Finally, CDN, reverse proxy, and application configurations should be tested together. The vulnerability may not exist in one component individually but can emerge from the way multiple components interact.</p><h3>Conclusion</h3><p>Web Cache Deception demonstrates that caching is not simply a performance mechanism; it can also become an important part of a web application’s attack surface.</p><p>The vulnerability primarily occurs when the cache and backend interpret the same URL differently, potentially causing a sensitive response to be cached even though it was intended to remain private to a specific user.</p><p>Understanding the relationship between URL parsing, application logic, and caching rules helps security testers and developers identify and prevent this class of vulnerability.</p><p>Ultimately, caching should be treated as part of the application’s security design, not merely as a performance optimization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9d617af56d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Host Header Attacks — From Basics to Practical Testing]]></title>
            <link>https://medium.com/@MazenElsayed_/http-host-header-attacks-from-basics-to-practical-testing-d382976188d3?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/d382976188d3</guid>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[host-header-injection]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 13:29:45 GMT</pubDate>
            <atom:updated>2026-09-27T13:29:45.520Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*geL2D4Nf-jd106B8OUAwRA.jpeg" /></figure><h3>Introduction</h3><p>The HTTP Host header is a fundamental part of HTTP requests. It tells the server which domain the client is trying to access.</p><p>A normal HTTP request looks like this:</p><pre>GET / HTTP/1.1<br>Host: example.com</pre><p>Although the Host header may appear harmless, applications often use its value for important operations such as URL generation, redirects, routing, and caching.</p><p>When an application trusts this value without proper validation, attackers may be able to manipulate its behavior.</p><p>This class of vulnerabilities is commonly known as <strong>HTTP Host Header Attacks</strong>.</p><h3>Understanding the Host Header</h3><p>The Host header identifies the target hostname of an HTTP request.</p><p>For example:</p><pre>GET /account HTTP/1.1<br>Host: example.com</pre><p>In a simple application, the server may only use this value to determine which website should handle the request.</p><p>However, some applications use the hostname dynamically when generating URLs:</p><pre>https://example.com/reset-password?token=...</pre><p>If the application obtains example.com directly from the HTTP request instead of using a trusted configuration value, an attacker may be able to influence the generated URL.</p><p>The important point is that the vulnerability does not come from the Host header itself.</p><p>The vulnerability comes from <strong>trusting and using attacker-controlled host information in a security-sensitive context</strong>.</p><h3>Common Host Header Attack Scenarios</h3><h3>1. Password Reset Poisoning</h3><p>One common scenario involves password reset functionality.</p><p>Suppose an application generates a reset link based on the incoming Host header:</p><pre>POST /forgot-password HTTP/1.1<br>Host: example.com</pre><p>The application may generate:</p><pre>https://example.com/reset?token=...</pre><p>If the attacker can influence the host:</p><pre>POST /forgot-password HTTP/1.1<br>Host: attacker.example</pre><p>the application might generate:</p><pre>https://attacker.example/reset?token=...</pre><p>Depending on the application’s implementation, this can lead to <strong>password reset poisoning</strong>.</p><p>The important part during testing is determining whether the manipulated hostname actually reaches the password-reset URL and whether the resulting flow exposes a security-sensitive token.</p><h3>2. Web Cache Poisoning</h3><p>Host Header manipulation can also become dangerous when combined with web caching.</p><p>A simplified attack flow looks like this:</p><pre>Attacker<br>   |<br>   | Manipulated Host Header<br>   v<br>Application<br>   |<br>   | Malicious Response<br>   v<br>Cache<br>   |<br>   | Cached Response<br>   v<br>Other Users</pre><p>If the cache does not correctly distinguish requests that produce different responses, an attacker may be able to cause a manipulated response to be stored and subsequently served to other users.</p><p>Therefore, when testing Host Header issues, cache behavior should also be considered.</p><h3>3. Virtual Host and Routing Issues</h3><p>Modern web servers frequently host multiple applications or services on the same infrastructure.</p><p>For example:</p><pre>www.example.com<br>admin.example.com<br>internal.example.com</pre><p>The server may use the Host header to determine which application should process the request.</p><p>If routing is incorrectly configured, manipulating the Host value may result in access to an unintended virtual host or application.</p><p>This makes Host Header testing useful during reconnaissance and web application testing.</p><h3>4. X-Forwarded-Host and Related Headers</h3><p>Applications deployed behind reverse proxies or load balancers may use additional headers such as:</p><pre>X-Forwarded-Host: example.com</pre><p>Other commonly encountered headers include:</p><pre>X-Forwarded-For<br>X-Forwarded-Proto<br>Forwarded</pre><p>These headers are not vulnerabilities by themselves.</p><p>The security issue appears when an application trusts values supplied by an untrusted client and uses them in a sensitive operation.</p><p>For this reason, testing should not be limited to the standard Host header.</p><h3>Testing Methodology</h3><p>A practical Host Header assessment can be divided into several steps.</p><h3>Step 1 — Identify Host-Dependent Functionality</h3><p>First, look for application functionality that may depend on the hostname.</p><p>Examples include:</p><ul><li>Password reset</li><li>Account verification</li><li>Email invitations</li><li>Redirects</li><li>Absolute URL generation</li><li>Multi-tenant routing</li><li>Cacheable responses</li><li>Virtual hosts</li></ul><p>These areas are particularly interesting because they may use the hostname dynamically.</p><h3>Step 2 — Modify the Host Header</h3><p>Send the request to Burp Suite Repeater and modify the Host header.</p><p>Original:</p><pre>GET / HTTP/1.1<br>Host: example.com</pre><p>Test:</p><pre>GET / HTTP/1.1<br>Host: test.example</pre><p>Then compare the responses.</p><p>Look for changes in:</p><ul><li>Response body</li><li>Redirects</li><li>Absolute URLs</li><li>Generated links</li><li>Application behavior</li><li>Cache-related headers</li></ul><h3>Step 3 — Test Forwarded Host Headers</h3><p>If changing the standard Host header has no useful effect, test headers commonly used by reverse proxies:</p><pre>GET / HTTP/1.1<br>Host: example.com<br>X-Forwarded-Host: test.example</pre><p>Depending on the infrastructure, other headers may also influence how the application determines its hostname.</p><p>The goal is not to blindly try every possible header, but to understand how the application’s proxy and backend architecture handles host information.</p><h3>Step 4 — Determine the Security Impact</h3><p>Reflection of the supplied hostname alone does not necessarily indicate a vulnerability.</p><p>The key question is:</p><blockquote><strong><em>Where is the attacker-controlled value being used?</em></strong></blockquote><p>For example:</p><pre>Host Header<br>     |<br>     v<br>URL Generation<br>     |<br>     v<br>Password Reset Link</pre><p>This is considerably more interesting than simply seeing the value reflected in a normal response.</p><p>Always connect the manipulated input to an actual security-sensitive behavior before reporting the issue.</p><h3>Testing with Burp Suite</h3><p>Burp Suite makes Host Header testing straightforward.</p><p>Capture a request using <strong>Proxy</strong>, send it to <strong>Repeater</strong>, and modify the hostname:</p><pre>GET /account HTTP/1.1<br>Host: test.example</pre><p>Then observe the response.</p><p>For example, if the application originally returns:</p><pre>Location: https://example.com/login</pre><p>and changing the Host produces:</p><pre>Location: https://test.example/login</pre><p>this indicates that the application may be using the Host header when generating redirects.</p><p>At this point, further testing is required to determine whether this behavior creates an exploitable security issue.</p><h3>Impact</h3><p>The impact of a Host Header vulnerability depends on how the application uses the manipulated value.</p><p>Potential consequences can include:</p><ul><li>Password reset poisoning</li><li>Web cache poisoning</li><li>Malicious redirects</li><li>Access to unintended virtual hosts</li><li>Routing problems</li><li>Manipulation of generated URLs</li><li>Authentication-related issues</li></ul><p>However, simply accepting an arbitrary Host header does <strong>not</strong> automatically mean the application is vulnerable.</p><p>The actual impact must be demonstrated through the application’s behavior.</p><h3>Mitigation</h3><p>Applications should avoid blindly trusting the incoming Host header.</p><p>Recommended protections include:</p><ol><li><strong>Use an allowlist of trusted hostnames.</strong></li><li><strong>Use a predefined canonical application URL for security-sensitive links.</strong></li><li><strong>Do not construct password-reset URLs from untrusted request data.</strong></li><li><strong>Configure reverse proxies and load balancers to validate host values.</strong></li><li><strong>Treat forwarded headers as untrusted unless they originate from a trusted proxy.</strong></li><li><strong>Ensure cache configurations correctly account for relevant request components.</strong></li></ol><p>For example, instead of:</p><pre>https://&lt;Host-header&gt;/reset?token=...</pre><p>the application should use a trusted origin:</p><pre>https://example.com/reset?token=...</pre><h3>Conclusion</h3><p>HTTP Host Header Attacks demonstrate how seemingly harmless request headers can become security-sensitive when applications trust them incorrectly.</p><p>During a penetration test, don’t stop after changing:</p><pre>Host: example.com</pre><p>to:</p><pre>Host: test.example</pre><p>The important part is understanding <strong>how the application uses the value</strong>.</p><p>By testing hostname-dependent functionality such as password resets, redirects, caching, routing, and forwarded headers, penetration testers can identify Host Header vulnerabilities that may otherwise remain hidden.</p><p>The core principle is simple:</p><blockquote><strong><em>Never trust attacker-controlled host information when it is used for security-sensitive operations.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d382976188d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web LLM Attacks: Understanding the New Web Application Attack Surface]]></title>
            <link>https://medium.com/@MazenElsayed_/web-llm-attacks-understanding-the-new-web-application-attack-surface-3ca768cf29b6?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ca768cf29b6</guid>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Fri, 18 Sep 2026 08:46:59 GMT</pubDate>
            <atom:updated>2026-09-18T08:48:50.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*z74fEvjyWnaU2GUFbUV73w.jpeg" /></figure><h3>Introduction</h3><p>As Large Language Models (LLMs) become increasingly integrated into web applications, they are no longer limited to answering user questions. They can become part of the application’s logic and interact with data, APIs, and internal tools. This introduces a new attack surface that combines AI-specific risks with traditional web application security vulnerabilities.</p><h3>What Makes LLM-Powered Web Apps Different?</h3><p>Traditional web applications typically rely on predefined logic and rules to process user input. LLM-powered applications introduce an additional layer that can understand natural language and make decisions based on context. When an LLM is connected to data, tools, or APIs, manipulating its input can potentially influence the behavior of the application itself.</p><h3><strong>Major Categories of Web LLM Attacks</strong></h3><p>Web LLM attacks include several major categories, such as Prompt Injection, Indirect Prompt Injection, Sensitive Information Disclosure, Insecure Output Handling, and Excessive Agency. While these attacks differ in technique, they commonly target how an application handles the LLM’s inputs, outputs, context, and permissions.</p><h4>1. Prompt Injection</h4><p>Prompt Injection occurs when an attacker attempts to manipulate an LLM’s instructions or context to influence its behavior or override its intended instructions. The risk becomes greater when the model is connected to sensitive data or application functionality.</p><h4>2. Indirect Prompt Injection</h4><p>Indirect Prompt Injection occurs when malicious instructions are embedded in external content that an LLM processes, such as a web page, document, or product description. The model may interpret this content as part of its context, allowing an attacker to influence the application’s behavior without directly controlling the model’s input.</p><h4>3. Sensitive Information Disclosure</h4><p>LLM attacks can lead to sensitive information disclosure when an attacker influences the model into revealing data that should not be accessible to them. This may include user information, internal instructions, or data retrieved from systems connected to the application.</p><h4>4. Insecure Output Handling</h4><p>Insecure Output Handling occurs when a web application treats LLM-generated output as trusted without properly validating or sanitizing it. If the output is used directly by the application, it can potentially lead to traditional web vulnerabilities such as Cross-Site Scripting.</p><h4>5. Excessive Agency</h4><p>Excessive Agency occurs when an LLM is given more permissions or capabilities than necessary for its intended function. If the model’s behavior is manipulated, these permissions could potentially be used to trigger unintended actions, especially when the model has access to sensitive data or functionality.</p><h3>Chaining LLM Attacks with Web Vulnerabilities</h3><p>LLM attacks can become more impactful when combined with traditional web vulnerabilities. For example, an attack may begin with Prompt Injection and lead to unsafe output or the invocation of an application function, turning an LLM-related issue into a broader security impact.</p><h3>Why Are Web LLM Applications Difficult to Secure?</h3><p>Securing Web LLM applications can be challenging because LLMs process natural language and context rather than relying only on fixed rules. Their behavior can also be influenced by how inputs and surrounding information are presented, making it difficult to consistently separate trusted instructions from untrusted content.</p><h3>Security Principles for Web LLM Applications</h3><p>Web LLM applications should follow the principle of least privilege and treat LLM inputs and outputs as untrusted by default. Strong authorization, validation of tool and API calls, and limited access to sensitive data and functionality are also important security measures.</p><h3>The Future of Web LLM Attacks</h3><p>As LLMs evolve from generating responses to performing actions and interacting with external systems, their attack surface will continue to grow. LLM security will therefore focus not only on what a model can say, but also on what it can access and what actions it is allowed to perform.</p><h3>Conclusion</h3><p>Web LLM attacks have become an important part of the evolving web application security landscape. Understanding these attacks requires treating the LLM as part of the application itself and examining how it handles inputs, data, tools, and permissions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ca768cf29b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WAF Explained: A Beginner’s Guide to Web Application Firewalls]]></title>
            <link>https://medium.com/@MazenElsayed_/waf-explained-a-beginners-guide-to-web-application-firewalls-33aeeea84f56?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/33aeeea84f56</guid>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 12:56:57 GMT</pubDate>
            <atom:updated>2026-08-25T12:56:57.516Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*Tf1s5so2NzpqqdGuDPwaeQ.jpeg" /></figure><h3>Introduction</h3><p>Most web applications today handle a large number of requests from users. Some of these requests are completely normal, such as logging in or searching for a product, while others may be malicious and attempt to exploit vulnerabilities in the application.</p><p>This is where a <strong>Web Application Firewall (WAF)</strong> comes in.</p><p>A WAF is a security layer designed to protect web applications by inspecting incoming web traffic and identifying potentially malicious requests. It primarily operates at <strong>Layer 7 (Application Layer)</strong> of the <strong>OSI model</strong>, which allows it to understand and inspect application-level traffic such as HTTP requests.</p><p>In this article, we will learn what a WAF is, why we need it, how it works at a basic level, and what types of attacks it can help detect and block. At the end, we will also take a brief look at the idea of <strong>WAF bypass</strong> through a couple of simple practical examples.</p><p>The goal of this article is not to dive into advanced topics, but to give beginners a clear understanding of the fundamentals of Web Application Firewalls.</p><h3>What Is a WAF?</h3><p><strong>WAF</strong> stands for <strong>Web Application Firewall</strong>. It is a type of firewall specifically designed to protect web applications.</p><p>Its main job is to inspect the <strong>HTTP/HTTPS requests</strong> sent by users to a web application and determine whether a request looks normal or contains something suspicious or malicious.</p><p>We can simply think of a WAF as a <strong>security guard standing in front of a web application</strong>.</p><p>When a user sends a request, it does not necessarily go directly to the web server. Instead, it first passes through the WAF. The WAF inspects the request and, if it looks normal, allows it to continue. If it detects something that matches a known malicious pattern, it may block the request.</p><p>In simple terms:</p><p><strong>User → WAF → Web Application</strong></p><p>For example, if an attacker sends a request containing a payload commonly associated with an attack such as <strong>SQL Injection</strong> or <strong>Cross-Site Scripting (XSS)</strong>, the WAF may detect the suspicious pattern and block the request before it reaches the application.</p><p>However, it is important to understand that a WAF is not a replacement for secure application development. It is an <strong>additional layer of protection</strong>, not a solution to the underlying vulnerabilities in the application itself.</p><h3>Why Do We Need a WAF?</h3><p>Any web application can be targeted by attackers. Web applications receive requests from the internet, so they cannot simply assume that every user or every request is safe.</p><p>For example, an attacker may try to send a request designed to exploit an <strong>SQL Injection</strong> vulnerability or inject malicious JavaScript through an <strong>XSS</strong> vulnerability.</p><p>Without proper protection, such a request may reach the application and be processed in a way that allows the vulnerability to be exploited.</p><p>This is where a WAF can provide an additional layer of defense between the user and the application.</p><p>Instead of having a direct path:</p><p><strong>Attacker → Web Application</strong></p><p>we have:</p><p><strong>Attacker → WAF → Web Application</strong></p><p>The WAF inspects the request before it reaches the application. If the request matches a known attack pattern, the WAF can block it.</p><p>This does not mean that a WAF can stop every possible attack. However, it can reduce the number of malicious requests reaching the application and provide an additional layer of protection.</p><p>This is why organizations often use WAFs as part of <strong>Defense in Depth</strong> — using multiple layers of security instead of relying on a single security mechanism.</p><h3>How Does a WAF Work?</h3><p>To understand how a WAF works, we can follow a request from the moment it is sent until it reaches the web application.</p><p>When a user sends a request, it first passes through the WAF. The WAF can inspect different parts of the request, such as:</p><ul><li>HTTP method</li><li>URL</li><li>Headers</li><li>Parameters</li><li>Request body</li></ul><p>The WAF then tries to determine whether the request looks normal or contains a pattern associated with a known attack.</p><p>For example, if there is a rule designed to detect patterns commonly associated with SQL Injection, the WAF may inspect the parameters in the request and compare them against those rules.</p><p>We can simplify the process into three steps:</p><p><strong>1. Receive</strong><br>The WAF receives the request.</p><p><strong>2. Inspect</strong><br>It inspects the request and compares it against its security rules.</p><p><strong>3. Allow or Block</strong><br>If the request is considered safe, it is allowed to reach the application. If it is considered malicious, the WAF can block it.</p><p>A simplified flow looks like this:</p><p><strong>User → Request → WAF → Inspect → Allow/Block</strong></p><p>The exact inspection process depends on the WAF implementation. Some systems rely heavily on <strong>signatures and rules</strong> to detect known attack patterns, while others use more advanced techniques.</p><p>This is why proper WAF configuration and rule management are important. Having a WAF does not automatically mean that every malicious request will be detected.</p><h3>What Can a WAF Protect Against?</h3><p>A WAF can help detect and block different types of attacks that target web applications. Some common examples include:</p><h3>SQL Injection</h3><p>In an <strong>SQL Injection</strong> attack, an attacker attempts to inject malicious SQL into application input in order to influence database queries.</p><p>A WAF can look for patterns commonly associated with SQL Injection and attempt to block the request.</p><h3>Cross-Site Scripting (XSS)</h3><p>With <strong>XSS</strong>, an attacker attempts to inject malicious JavaScript into a location where it may later be displayed or executed in a user’s browser.</p><p>A WAF can detect some XSS payloads and patterns and block the request.</p><h3>Path Traversal</h3><p>In a <strong>Path Traversal</strong> attack, an attacker attempts to access files or directories outside the location intended by the application.</p><p>A WAF can detect some common patterns used in these attacks and block the request.</p><h3>Malicious Requests</h3><p>Beyond these examples, a WAF can detect many other suspicious request patterns depending on its rules and configuration.</p><p>However, it is important to understand that this protection is <strong>not guaranteed</strong>. A WAF relies on its detection mechanisms and configured rules, so there are situations where it may fail to detect or block a particular attack.</p><p>For this reason, a WAF should be part of a broader security strategy rather than the application’s only line of defense.</p><h3>A Simple Example</h3><p>Let’s say we have a web application with a login page that accepts a username and password.</p><p>When a user submits their credentials, a request is sent to the server:</p><p><strong>User → WAF → Web Application</strong></p><p>The WAF inspects the request before it reaches the application.</p><p>If the input looks normal, such as:</p><pre>username=mazen<br>password=123456</pre><p>there is no obvious indication of an attack, so the WAF can allow the request to continue.</p><p>Now imagine that an attacker tries to send input containing a pattern commonly associated with SQL Injection.</p><p>In this case, the WAF may recognize the suspicious pattern and, based on its configured rules, block the request.</p><p>The flow would look like this:</p><pre>Normal Request<br>      ↓<br>     WAF<br>      ↓<br>   Allowed<br>      ↓<br>Web Application</pre><p>For a suspicious request:</p><pre>Malicious Request<br>      ↓<br>     WAF<br>      ↓<br>    Blocked<br>      ✕<br>Web Application</pre><p>This demonstrates the basic idea behind a WAF: <strong>inspect requests and attempt to prevent requests that appear malicious from reaching the application.</strong></p><p>But what happens when a malicious request manages to get past this protection?</p><p>This brings us to the idea of <strong>WAF Bypass</strong>.</p><h3>A Quick Look at WAF Bypass</h3><p>A WAF is designed to detect and block requests that appear to be malicious, but it is not perfect.</p><p>In some cases, a WAF may rely on <strong>rules</strong> or <strong>signatures</strong> that look for specific patterns inside a request. If the structure of a payload changes while its functionality or effect remains similar, the WAF may fail to recognize it.</p><p>To understand this idea, let’s look at two simple examples.</p><p>Suppose we are testing a vulnerable application that contains an <strong>XSS</strong> vulnerability.</p><p>We try a simple payload:</p><pre>&lt;script&gt;alert(1)&lt;/script&gt;</pre><p>However, the WAF detects this pattern and blocks the request.</p><p>Instead of assuming that the vulnerability cannot be exploited, we can analyze how the WAF detects the input and try a different representation.</p><p>For example:</p><pre>&lt;img src=x onerror=alert(1)&gt;</pre><p>If the WAF allows the request and the application executes the payload, this means that the WAF successfully blocked one form of the XSS payload but failed to recognize another form.</p><p>The same idea can be applied to <strong>SQL Injection</strong>.</p><p>Let’s say we have a vulnerable application with a parameter such as:</p><pre>?id=1</pre><p>During testing, we try a common SQL Injection payload:</p><pre>?id=1&#39; OR &#39;1&#39;=&#39;1</pre><p>The WAF detects the pattern and blocks the request.</p><p>We can then test another representation:</p><pre>?id=1&#39; OR 1=1--</pre><p>If the first payload is blocked while the second one reaches the application, this demonstrates an important concept: the WAF may be detecting a <strong>specific pattern</strong> rather than fully understanding the underlying attack.</p><p>The overall idea can be summarized as:</p><p><strong>Original Payload → WAF Detects Pattern → Request Blocked</strong></p><p>Then:</p><p><strong>Different Representation → WAF Misses the Pattern → Request Reaches the Application</strong></p><p>This does not mean that every alternative payload will bypass a WAF. The result depends on the WAF, its rules, normalization, and how the backend processes the request.</p><p>The important lesson is not to memorize payloads. Instead, we should understand <strong>why a WAF may detect one representation while missing another</strong>.</p><p>This also demonstrates why a WAF should not be the only security mechanism protecting a vulnerable application. A WAF is an additional layer of protection, while the underlying vulnerability should still be fixed in the application itself.</p><h3>Is a WAF Enough to Secure an Application?</h3><p>After learning how a WAF works, it may seem like it can protect an application from most attacks. However, the reality is different.</p><p>A WAF is an <strong>additional layer of protection</strong>, not a replacement for securing the application itself.</p><p>If an application contains an SQL Injection, XSS, or another vulnerability, the proper solution is to fix the vulnerability in the application rather than relying only on the WAF to prevent exploitation.</p><p>Developers should use techniques such as:</p><ul><li>Input validation</li><li>Parameterized queries</li><li>Output encoding</li><li>Secure authentication and authorization</li><li>Proper error handling</li></ul><p>We can think about it this way:</p><p><strong>Secure Application + WAF = Stronger Defense</strong></p><p>Not:</p><p><strong>Vulnerable Application + WAF = Secure Application</strong></p><p>A WAF can be a very important part of a security strategy, but it is most effective when combined with secure development practices and other security controls.</p><p>This is the idea behind <strong>Defense in Depth</strong>: instead of relying on a single security layer, we use multiple layers so that if one layer fails, others can still provide protection.</p><h3>Conclusion</h3><p>A <strong>Web Application Firewall (WAF)</strong> is an important security layer that helps protect web applications from many types of malicious requests and attacks.</p><p>In this article, we learned what a WAF is, why we need it, how it inspects HTTP requests, and some of the attacks it can help detect and block.</p><p>We also saw through the WAF bypass examples that a WAF is not perfect. Its ability to detect an attack depends on factors such as its rules and how it analyzes incoming requests.</p><p>For this reason, a WAF should never be the only line of defense. Securing the application itself and combining the WAF with other security layers is a much better approach to building secure web applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33aeeea84f56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Architecture Explained: From Linux Kernel to Applications]]></title>
            <link>https://medium.com/@MazenElsayed_/android-architecture-explained-from-linux-kernel-to-applications-0cf3b6904104?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cf3b6904104</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 00:45:12 GMT</pubDate>
            <atom:updated>2026-08-18T00:59:04.050Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*igvyuoZvHbS19xqjgg4dQQ.jpeg" /></figure><h3>Introduction</h3><p>When we use an Android application, everything seems simple: we open the app, tap a button, and get a result. Behind that simple interface, however, a large number of components work together to run the application and communicate with the operating system and the underlying hardware.</p><p>Android is not simply a collection of applications. It is a complete operating system built from multiple layers, with each layer responsible for a specific set of tasks. These layers start with the <strong>Linux Kernel</strong> at the bottom, followed by the <strong>Hardware Abstraction Layer (HAL)</strong>, <strong>Native Libraries</strong>, <strong>Android Runtime (ART)</strong>, and <strong>Application Framework</strong>, eventually reaching the <strong>Applications</strong> that users interact with.</p><p>Understanding these layers is important for anyone who wants to understand what happens inside Android instead of treating the operating system as a black box. Whether you are using the camera, playing audio, opening an application, or accessing a file, the operation may pass through multiple components and layers before producing the final result.</p><p>In this article, we will explore <strong>Android Architecture</strong> from the bottom up, explaining the purpose of each layer and how these layers interact with one another. The goal is to build a clear mental model of how Android works as an integrated operating system.</p><h3>Android Architecture Overview</h3><p>Android Architecture can be viewed as a set of layers built on top of one another, where each layer provides functionality that is used by the layers above it.</p><p>From bottom to top, the core architecture can be represented as:</p><pre>┌─────────────────────────────┐<br>│        Applications         │<br>├─────────────────────────────┤<br>│    Application Framework    │<br>├─────────────────────────────┤<br>│   Android Runtime (ART)     │<br>│      + Native Libraries     │<br>├─────────────────────────────┤<br>│ Hardware Abstraction Layer  │<br>│            (HAL)            │<br>├─────────────────────────────┤<br>│        Linux Kernel         │<br>└─────────────────────────────┘</pre><p>At the bottom of the system is the <strong>Linux Kernel</strong>, which handles fundamental tasks such as process management, memory management, and hardware interaction.</p><p>Above the kernel is the <strong>Hardware Abstraction Layer (HAL)</strong>, which provides interfaces that allow higher-level Android components to interact with different types of hardware.</p><p>Next are the <strong>Native Libraries</strong> and the <strong>Android Runtime (ART)</strong>. Native Libraries provide low-level functionality used throughout the system, while ART provides the runtime environment responsible for executing Android applications.</p><p>Above these components is the <strong>Application Framework</strong>, which provides the APIs and system services that applications use to access Android functionality.</p><p>At the top of the architecture are <strong>Applications</strong>, which are the applications users interact with directly.</p><p>These layers do not operate independently. They work together and communicate with one another to form the complete Android operating system. In the following sections, we will examine each layer individually and understand its role within the architecture.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>1. Linux Kernel</h3><p>At the bottom of the Android Architecture is the <strong>Linux Kernel</strong>, which provides the foundation on which the rest of the system is built. It manages the device’s core resources and provides the interfaces required by higher-level components to interact with the system and hardware.</p><p>Some of the main responsibilities handled by the kernel include:</p><ul><li><strong>Process Management</strong> — managing processes and threads.</li><li><strong>Memory Management</strong> — allocating and managing memory.</li><li><strong>Networking</strong> — providing networking and communication capabilities.</li><li><strong>File System Management</strong> — managing files and storage.</li><li><strong>Device Drivers</strong> — communicating with hardware components.</li></ul><h3>Device Drivers</h3><p>One of the most important roles of the Linux Kernel is managing <strong>Device Drivers</strong>, which allow Android to communicate with different hardware components.</p><p>These components can include:</p><ul><li>Camera</li><li>Display</li><li>Audio</li><li>Wi-Fi</li><li>Bluetooth</li><li>Touchscreen</li><li>Sensors</li></ul><p>For example, when Android needs to interact with the camera, an application does not communicate directly with the camera hardware. Instead, the operation passes through the appropriate Android layers until it reaches the driver responsible for communicating with the hardware.</p><h3>Android and the Linux Kernel</h3><p>Although Android relies on the Linux Kernel, Android is not simply a traditional Linux distribution.</p><p>Android adds its own components and modifications to meet the requirements of mobile devices, including power management, application execution, and support for different hardware configurations.</p><p>The Linux Kernel can therefore be considered the starting point of Android Architecture, providing the foundation on which the rest of the Android system is built.</p><p>In the next section, we will move up to the <strong>Hardware Abstraction Layer (HAL)</strong>, which acts as an interface between higher-level Android components and the underlying hardware.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>2. Hardware Abstraction Layer (HAL)</h3><p>Above the <strong>Linux Kernel</strong> is the <strong>Hardware Abstraction Layer (HAL)</strong>. Its main purpose is to provide standardized interfaces that allow higher-level Android components to interact with hardware without needing to understand the implementation details of each hardware component.</p><p>To understand the idea, consider that Android runs on devices from many different manufacturers. Each device may use different cameras, microphones, sensors, and other hardware components. If the Android Framework had to communicate directly with the implementation details of every piece of hardware, the system would become extremely complex.</p><p>This is where HAL comes in.</p><p>Instead of communicating directly with every hardware implementation, higher-level components interact with <strong>interfaces</strong> provided by HAL. The HAL implementation then handles the hardware-specific details.</p><p>The concept can be simplified as:</p><pre>Android Framework<br>        ↓<br>       HAL<br>        ↓<br>Hardware-specific implementation<br>        ↓<br>  Linux Kernel<br>        ↓<br>    Hardware</pre><h3>Examples of HAL</h3><p>Android provides HAL interfaces for different types of hardware, including:</p><ul><li><strong>Camera HAL</strong> — camera functionality.</li><li><strong>Audio HAL</strong> — audio functionality.</li><li><strong>Sensors HAL</strong> — sensors.</li><li><strong>Graphics HAL</strong> — graphics and display functionality.</li><li><strong>Bluetooth HAL</strong> — Bluetooth functionality.</li></ul><p>For example, when Android needs to access the camera, the Framework does not need to know which specific camera sensor is installed in the device. It communicates through the appropriate Camera interface, while the HAL handles the hardware-specific implementation.</p><h3>Why Is HAL Important?</h3><p>HAL makes Android more <strong>modular</strong> and adaptable to different hardware configurations.</p><p>A device manufacturer can use completely different hardware from another manufacturer while higher-level Android components can still rely on the same general interfaces instead of requiring the entire system to be rewritten for every device.</p><p>In this way, HAL provides a clear separation between the <strong>Android Framework</strong> and hardware-specific implementation details.</p><p>Next, we will move to <strong>Native Libraries</strong>, a collection of low-level libraries that provide essential functionality used by different parts of Android.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>3. Native Libraries</h3><p>Above the <strong>Hardware Abstraction Layer (HAL)</strong> are the <strong>Native Libraries</strong>, a collection of software libraries that provide essential low-level functionality used throughout the Android system.</p><p>Many of these libraries are primarily written in <strong>C and C++</strong> and are used by different parts of Android that require high performance or lower-level access to system resources.</p><h3>Examples of Native Libraries</h3><p>Android includes many native libraries, each serving a different purpose. Some examples include:</p><ul><li><strong>SQLite</strong> — provides embedded database functionality.</li><li><strong>Bionic</strong> — Android’s C library.</li><li><strong>OpenGL ES</strong> — provides graphics APIs for 2D and 3D rendering.</li><li><strong>libbinder</strong> — provides the native implementation of Binder IPC.</li><li><strong>Media components</strong> — provide media playback and processing functionality.</li></ul><p>These libraries do not operate as a completely isolated layer. They are used by various parts of the system, including the Android Runtime, Application Framework, and system services.</p><h3>Native Code in Android</h3><p>Because many of these libraries are written in <strong>C/C++</strong>, Android can take advantage of the performance and low-level control provided by these languages.</p><p>Android applications can also use native code when necessary. For example, developers can use the <strong>Android NDK</strong> to run parts of an application written in C or C++.</p><p>Therefore, Android does not rely entirely on Java or Kotlin. A significant amount of native code operates behind the scenes to provide many of the platform’s core capabilities.</p><p>Next, we reach one of the most important layers of Android Architecture: the <strong>Android Runtime (ART)</strong>, which provides the environment in which Android applications are executed.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>4. Android Runtime (ART)</h3><p>Above the <strong>Native Libraries</strong> is the <strong>Android Runtime (ART)</strong>, the runtime environment responsible for executing Android applications.</p><p>When developers write an application using <strong>Kotlin</strong> or <strong>Java</strong>, the source code is not executed directly on the device. It is first compiled into bytecode in the <strong>DEX (Dalvik Executable)</strong> format, which is then executed within the ART environment.</p><p>The process can be simplified as:</p><pre> Kotlin / Java Code<br>        ↓<br>     Compiler<br>        ↓<br>    DEX Bytecode<br>        ↓<br>       ART<br>        ↓<br>    Application</pre><h3>From Dalvik to ART</h3><p>In older versions of Android, applications were executed using the <strong>Dalvik Virtual Machine</strong>.</p><p>Starting with <strong>Android 5.0 (Lollipop)</strong>, <strong>ART</strong> became the primary runtime and replaced Dalvik.</p><p>ART introduced improvements to application execution and system performance, along with improvements in memory management and garbage collection.</p><h3>How Does ART Execute Applications?</h3><p>ART does not rely on a single execution technique. It uses technologies such as <strong>JIT (Just-In-Time)</strong> and <strong>AOT (Ahead-Of-Time)</strong> compilation to improve application performance.</p><p>In simple terms:</p><ul><li><strong>JIT</strong> compiles parts of the code while the application is running.</li><li><strong>AOT</strong> compiles parts of the code ahead of execution, reducing the need to compile them during runtime.</li></ul><p>Modern Android versions use a combination of these techniques to balance performance, application startup time, and resource usage.</p><h3>Garbage Collection</h3><p>ART is also responsible for <strong>Garbage Collection (GC)</strong>, which manages memory and reclaims memory that is no longer being used by applications.</p><p>This allows developers using Java and Kotlin to work with automatic memory management instead of manually managing memory in the same way required by languages such as C and C++.</p><h3>ART and Native Code</h3><p>Although ART is responsible for executing DEX bytecode, it also works alongside <strong>Native Libraries</strong>.</p><p>Applications that require native functionality can use the <strong>Android NDK</strong> to run C/C++ code, which can interact with other parts of Android through native interfaces.</p><p>ART is therefore not an isolated environment. It is part of a larger collection of components that work together to execute Android applications.</p><p>Now that we understand ART, we can move to another important layer for application developers: the <strong>Application Framework</strong>, which provides the APIs and system services applications use to access Android functionality.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>5. Application Framework</h3><p>Above the <strong>Android Runtime (ART)</strong> is the <strong>Application Framework</strong>, which provides applications with APIs and system services that allow them to access Android functionality.</p><p>Instead of requiring every application to communicate directly with the Linux Kernel or hardware, the Application Framework provides high-level interfaces that developers can use through the Android SDK.</p><p>For example, when an application needs to open another screen, access the camera, or retrieve the device’s location, it uses Framework APIs instead of dealing with low-level implementation details.</p><h3>Major Application Framework Components</h3><p>The Framework contains a large collection of managers and system services. Some of the most important ones include:</p><ul><li><strong>Activity Manager</strong> — manages Activities and application lifecycle.</li><li><strong>Window Manager</strong> — manages application windows and displays.</li><li><strong>Package Manager</strong> — manages information about installed applications and packages.</li><li><strong>Location Manager</strong> — provides location-related services.</li><li><strong>Notification Manager</strong> — manages notifications.</li><li><strong>Resource Manager</strong> — provides access to resources such as strings and images.</li><li><strong>Content Providers</strong> — provide a structured mechanism for sharing data between applications.</li></ul><p>These components provide an abstraction layer for applications, allowing developers to use Android functionality without needing to understand how it is implemented in the lower layers.</p><h3>System Services</h3><p>An important part of the Application Framework is the collection of <strong>System Services</strong>.</p><p>Many functions that appear simple from an application’s perspective are actually handled by system services running in the background.</p><p>For example, when an application requests location information, it does not communicate directly with the GPS hardware. Instead, it interacts with the appropriate Framework components, which communicate with the system services responsible for providing the functionality.</p><p>The relationship can be simplified as:</p><pre>Application<br>     ↓<br>Framework API<br>     ↓<br>System Service<br>     ↓<br>Lower Android Layers<br>     ↓<br>Hardware</pre><h3>Why Is This Layer Important?</h3><p>The Application Framework is where Android applications begin interacting with system capabilities at a high level.</p><p>Instead of implementing low-level functionality for every operation, developers can use ready-made APIs such as:</p><pre>Camera API<br>Location API<br>Notification API<br>Package API<br>Activity API</pre><p>This makes application development easier while keeping the underlying system implementation details hidden from applications.</p><p>We can now move to the highest layer of Android Architecture: <strong>Applications</strong>, the layer users interact with directly.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>6. Applications</h3><p>The <strong>Applications</strong> layer represents the highest level of Android Architecture and is the layer users interact with directly.</p><p>This layer includes applications that come pre-installed with the system, such as:</p><ul><li>Phone</li><li>Messages</li><li>Camera</li><li>Settings</li><li>Browser</li></ul><p>It also includes applications installed by users from the <strong>Google Play Store</strong> or other sources.</p><p>Although applications perform different functions, all of them rely on the lower Android layers to access system features and hardware resources.</p><p>For example, if an application wants to capture a photo, the request may pass through:</p><pre>  Application<br>      ↓<br>Application Framework<br>      ↓<br>System Services<br>      ↓<br>     HAL<br>      ↓<br> Linux Kernel<br>      ↓<br>   Hardware</pre><h3>Android Application Components</h3><p>An Android application is typically composed of several core components:</p><ul><li><strong>Activities</strong> — represent screens and user interfaces.</li><li><strong>Services</strong> — perform background operations.</li><li><strong>Broadcast Receivers</strong> — receive events and system messages.</li><li><strong>Content Providers</strong> — provide a structured mechanism for sharing data.</li></ul><p>These components work together to provide a complete user experience.</p><h4><strong>— — — —— —I will talk about them in another article — — — — — — —</strong></h4><h3>Applications and Android Architecture</h3><p>The Applications layer demonstrates the main goal of Android Architecture: allowing applications to run on different devices without requiring developers to understand hardware-specific implementation details.</p><p>Developers interact with APIs and system services, while the lower layers handle resource management, system functionality, and hardware communication.</p><p>Together, all Android layers form a complete operating system that combines flexibility, scalability, and support for a wide variety of devices.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>How the Layers Work Together</h3><p>After examining the individual layers of Android Architecture, it is important to understand how these layers work together when the system performs a real operation.</p><p>Suppose a user opens the camera application and presses the shutter button. From the user’s perspective, the operation appears simple. Behind the scenes, however, multiple Android layers work together to complete it.</p><p>The process can be simplified as:</p><pre>Camera Application<br>        ↓<br>Application Framework<br>        ↓<br>Camera System Service<br>        ↓<br>   Camera HAL<br>        ↓<br>Linux Kernel / Driver<br>        ↓<br> Camera Hardware</pre><p>The application starts by using the <strong>Camera API</strong> provided by the Application Framework. The Framework communicates with the system service responsible for camera functionality, which then interacts with the <strong>Camera HAL</strong>.</p><p>The HAL handles the hardware-specific implementation, while the Linux Kernel and the appropriate device driver provide the interface needed to communicate with the physical camera hardware.</p><p>A similar process occurs when an application plays audio, accesses the network, or uses a device sensor. The exact components involved may differ, but the general principle remains the same: each layer has a specific responsibility and communicates with the components it depends on.</p><p>This architecture allows applications to run across a wide range of devices without requiring developers to understand the implementation details of every hardware component.</p><p>It also makes Android more <strong>modular</strong>, allowing individual components to be modified or improved without requiring the entire system architecture to be redesigned.</p><p>Ultimately, Android’s layers do not operate as isolated components. They form an interconnected system in which applications rely on the Framework, the Framework relies on the Runtime and system services, and these components rely on the native layers and kernel to access system resources.</p><p>This interaction is what allows Android to turn application code into real operations that can interact with the operating system and the underlying hardware in a structured way.</p><h3>Conclusion</h3><p>Understanding Android Architecture is not simply about knowing the names of the layers that make up the system. It is about understanding how these layers interact to execute applications and manage the device’s resources.</p><p>Starting with the <strong>Linux Kernel</strong>, which handles core system functionality and resource management, Android builds upward through the <strong>HAL</strong>, which abstracts hardware-specific implementations, and <strong>Native Libraries</strong>, which provide low-level functionality. Above them, <strong>Android Runtime (ART)</strong> provides the environment for executing applications, while the <strong>Application Framework</strong> provides the APIs and services that applications rely on.</p><p>This layered design allows Android to run across a wide variety of devices while keeping the responsibilities of different components separated. Understanding these relationships also provides a clearer picture of how operations move from an application through the operating system and eventually interact with the underlying hardware.</p><p>This knowledge is not limited to application development. Understanding Android Architecture is also an important foundation for studying Android Security. Concepts such as application isolation, permissions, IPC, and system boundaries become much easier to understand once the underlying architecture is clear.</p><p>Ultimately, the deeper your understanding of the layers that make up Android, the easier it becomes to understand what happens behind an application’s interface — whether you are an <strong>Android Developer</strong> or a <strong>Security Researcher</strong>.</p><p>Android may look simple from the outside, but underneath the interface is a layered system where every component has a specific role. Understanding those layers is the first step toward understanding Android itself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cf3b6904104" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AS-REP Roasting Explained: Abusing Kerberos Pre-Authentication in Active Directory]]></title>
            <link>https://medium.com/@MazenElsayed_/as-rep-roasting-explained-abusing-kerberos-pre-authentication-in-active-directory-8bc0d30031ec?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bc0d30031ec</guid>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Sun, 17 May 2026 22:23:06 GMT</pubDate>
            <atom:updated>2026-05-17T22:23:06.532Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eSh7FvVG2-214stxQTkdzA.png" /></figure><h3>Introduction</h3><p>Active Directory environments rely heavily on the Kerberos authentication protocol to securely authenticate users and services across the network. One of the important security features within Kerberos is Pre-Authentication, which helps verify a user’s identity before issuing authentication data.</p><p>However, when Kerberos Pre-Authentication is disabled for specific accounts, attackers may abuse this misconfiguration through a technique known as AS-REP Roasting.</p><p>AS-REP Roasting allows an attacker to request authentication data for vulnerable user accounts without needing to know their passwords. The response returned by the Domain Controller contains encrypted data that can be extracted and cracked offline in an attempt to recover the user’s password.</p><p>Because the attack can be performed without administrative privileges and may not generate obvious suspicious behavior, AS-REP Roasting remains a valuable technique for attackers targeting Active Directory environments.</p><p>In this article, we will explore how Kerberos Pre-Authentication works, how AS-REP Roasting attacks are performed, and how organizations can detect and mitigate this threat.</p><h3>How Does Kerberos Pre-Authentication Work?</h3><p>To properly understand AS-REP Roasting, it is important to first understand the role of Pre-Authentication within the Kerberos protocol.</p><p>When a user attempts to log in within an Active Directory environment, the client sends a request known as an AS-REQ to the Domain Controller in order to obtain a Ticket Granting Ticket (TGT).</p><p>Under normal circumstances, the Domain Controller does not immediately send authentication data unless the user proves knowledge of their password first. This is where Kerberos Pre-Authentication comes into play.</p><p>With Pre-Authentication enabled, the user includes encrypted data within the AS-REQ request using their password. If the Domain Controller successfully decrypts and validates this data, it responds with an AS-REP message containing the TGT.</p><p>However, if Pre-Authentication is disabled for a specific account, the Domain Controller may return the AS-REP response directly without requiring proof of password knowledge.</p><p>The issue is that part of the AS-REP response is encrypted using the user’s password. This allows an attacker to extract the encrypted data and attempt to crack it offline using specialized tools.</p><p>For this reason, disabling Kerberos Pre-Authentication is considered a dangerous configuration that may expose accounts to AS-REP Roasting attacks.</p><h3>What is AS-REP Roasting?</h3><p>AS-REP Roasting is an attack technique that targets Active Directory accounts with Kerberos Pre-Authentication disabled.</p><p>Under normal circumstances, Kerberos requires users to prove knowledge of their password before the Domain Controller sends authentication data. However, when Pre-Authentication is disabled, any user within the network can request an AS-REP response for the target account without knowing the password.</p><p>The AS-REP response contains data encrypted with the target user’s password. An attacker can extract this encrypted data and attempt to crack it offline using tools such as Hashcat or John the Ripper.</p><p>AS-REP Roasting is especially dangerous because it does not require elevated privileges, nor does it rely on interacting directly with the victim or executing commands on their machine.</p><p>If the account password is weak or predictable, the attacker may successfully recover it within a short period of time, potentially leading to account compromise and access to sensitive network resources.</p><p>For this reason, disabling Kerberos Pre-Authentication is considered a risky configuration and should only be used in rare and carefully controlled situations.</p><h3>How Does the AS-REP Roasting Attack Work?</h3><p>The AS-REP Roasting attack abuses Active Directory accounts that have Kerberos Pre-Authentication disabled.</p><p>The attack can be summarized in the following steps:</p><ol><li>The attacker begins by identifying accounts within the domain that do not require Kerberos Pre-Authentication.</li><li>After identifying a target account, the attacker sends an AS-REQ request to the Domain Controller without providing proof of password knowledge.</li><li>If Pre-Authentication is disabled for the target account, the Domain Controller responds directly with an AS-REP message.</li><li>The AS-REP response contains data encrypted using the password of the target account.</li><li>The attacker extracts the encrypted portion of the response and converts it into a crackable format using specialized tools.</li><li>Offline password cracking is then performed in an attempt to recover the account password without requiring any further interaction with the Domain Controller.</li></ol><p>If the password is weak or commonly used, the attacker may successfully crack it and gain access to the targeted account.</p><p>AS-REP Roasting is particularly dangerous because it does not require administrative privileges, and the password cracking process occurs entirely offline, making malicious activity more difficult to detect.</p><h3>Detection and Mitigation</h3><p>Although AS-REP Roasting relies on Kerberos misconfigurations, organizations can significantly reduce the risk of this attack by applying several important security measures.</p><p>The most important defensive step is ensuring that Kerberos Pre-Authentication is enabled for all accounts within Active Directory. Disabling this feature is the primary condition that makes the attack possible.</p><p>Organizations should also enforce strong and complex passwords for sensitive accounts, since the attack relies heavily on offline password cracking. Long and randomly generated passwords make the cracking process far more difficult and time-consuming.</p><p>It is also important to regularly audit accounts with Pre-Authentication disabled and verify that no outdated or unnecessary accounts remain exposed.</p><p>From a detection perspective, security teams can monitor unusual or repeated AS-REQ requests within Kerberos logs, as these may indicate attempts to identify vulnerable accounts.</p><p>Applying the principle of least privilege and limiting permissions for sensitive accounts can also reduce the impact of a successful compromise.</p><p>By maintaining proper account management, enforcing strong password policies, and continuously monitoring Kerberos activity, organizations can greatly reduce the effectiveness of AS-REP Roasting attacks.</p><h3>Conclusion</h3><p>AS-REP Roasting is a dangerous attack technique that targets Active Directory environments by abusing accounts with Kerberos Pre-Authentication disabled.</p><p>The attack allows attackers to obtain encrypted authentication data without knowing the password or requiring elevated privileges, then attempt to crack the data offline to recover the target account’s password.</p><p>AS-REP Roasting is particularly dangerous because of its simplicity and its reliance on misconfigurations that may go unnoticed within large networks, especially when weak or outdated passwords are used.</p><p>Understanding how Kerberos Pre-Authentication works and how attackers abuse it is an important step for both penetration testers and defensive security teams.</p><p>Although detecting this type of attack can sometimes be difficult, organizations can significantly reduce the risk by enabling Pre-Authentication, enforcing strong password policies, regularly auditing account configurations, and continuously monitoring Kerberos activity.</p><p>As Active Directory continues to play a critical role in enterprise infrastructure, understanding attacks such as AS-REP Roasting helps organizations build stronger and more resilient security environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bc0d30031ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kerberoasting Explained: From Ticket Request to Cracking Service Account Passwords]]></title>
            <link>https://medium.com/@MazenElsayed_/kerberoasting-explained-from-ticket-request-to-cracking-service-account-passwords-f2cc14a23b2c?source=rss-21fdea769808------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2cc14a23b2c</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[Mazen Elsayed]]></dc:creator>
            <pubDate>Sun, 17 May 2026 12:08:49 GMT</pubDate>
            <atom:updated>2026-05-17T12:08:49.602Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Kerberoasting Explained: From Ticket Request to Cracking Service Account Passwords</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MM6XLy-E8ntVEbTseuihpQ.png" /></figure><h3>Introduction</h3><p>Modern Active Directory environments rely heavily on the Kerberos authentication protocol for secure communication between users and services. While Kerberos is considered secure by design, misconfigurations and weak service account passwords can expose organizations to dangerous attacks.</p><p>One of the most well-known attacks targeting Active Directory is Kerberoasting. This technique allows an attacker with a low-privileged domain account to request service tickets associated with Service Principal Names (SPNs) and extract encrypted ticket data that can later be cracked offline to recover service account passwords.</p><p>Because the attack does not require administrative privileges and generates legitimate Kerberos traffic, Kerberoasting remains a common technique used by penetration testers and real-world attackers during internal network engagements.</p><p>In this article, we will understand how Kerberoasting works, how attackers abuse Kerberos tickets, and how defenders can detect and mitigate the attack.</p><h3>How Kerberos Authentication Works</h3><p>To properly understand Kerberoasting, it is important to first understand how the Kerberos authentication protocol operates inside an Active Directory environment.</p><p>Kerberos relies on a ticket-based authentication system that allows users and services to verify identities without transmitting passwords directly over the network.</p><p>When a user logs in, the process works roughly as follows:</p><ol><li>The user sends a request to the Domain Controller to obtain a Ticket Granting Ticket (TGT).</li><li>After validating the user’s credentials, the Domain Controller issues the TGT to the user.</li><li>When the user attempts to access a specific service such as SQL Server or IIS, the client presents the TGT to the Domain Controller and requests a Service Ticket for that service.</li><li>The Domain Controller generates a Ticket Granting Service Ticket (TGS Ticket), which is encrypted using the password hash of the service account associated with the SPN.</li><li>The client then uses this ticket to authenticate to the service without needing to resend the password.</li></ol><p>The weakness exploited in Kerberoasting is that an attacker can request TGS tickets for any SPN-associated service within the domain, extract the encrypted portion of the ticket, and attempt to crack it offline.</p><h3>What is Kerberoasting?</h3><p>Kerberoasting is an attack technique that targets service accounts within an Active Directory environment by abusing the way the Kerberos authentication protocol works.</p><p>In Windows environments, many services — such as SQL Server, IIS, and others — run using special accounts known as Service Accounts. These accounts are often associated with Service Principal Names (SPNs), which allow clients to identify and request access to a specific service.</p><p>When a user requests access to a service, the Domain Controller issues a TGS ticket (Ticket Granting Service ticket). This ticket is encrypted using the password hash of the service account associated with the SPN.</p><p>The idea behind Kerberoasting is that any low-privileged domain user can request these service tickets without requiring administrative privileges, extract the encrypted portion of the ticket, and attempt to crack it offline using tools such as Hashcat or John the Ripper.</p><p>If the service account password is weak or predictable, the attacker may successfully recover it, which can later lead to privilege escalation and deeper compromise of the internal network.</p><h3>Understanding Service Principal Names (SPNs)</h3><p>Service Principal Names (SPNs) are a fundamental part of how Kerberos operates within an Active Directory environment.</p><p>An SPN is a unique identifier that maps a specific service to the service account running it. This allows clients within the network to correctly identify and authenticate to services.</p><p>For example, a SQL Server service may have an SPN similar to the following:</p><p>MSSQLSvc/server01.domain.local:1433</p><p>When a user attempts to access this service, Kerberos uses the SPN to identify the associated service account, and the Domain Controller generates a TGS ticket encrypted with that account’s password hash.</p><p>SPNs are important in Kerberoasting because any authenticated domain user can enumerate accounts associated with registered SPNs. This allows attackers to identify potentially vulnerable service accounts and request service tickets for them.</p><p>Service accounts often use long-lasting passwords and may sometimes rely on weak or predictable credentials, making them attractive targets for offline password cracking attacks.</p><h3>How Does the Kerberoasting Attack Work?</h3><p>The Kerberoasting attack abuses the normal behavior of the Kerberos authentication protocol when issuing service tickets for services associated with SPNs.</p><p>The attack can be summarized in the following steps:</p><ol><li>The attacker gains access to a regular low-privileged domain account. Administrative privileges are not required.</li><li>The attacker enumerates accounts associated with SPNs inside Active Directory to identify targetable services.</li><li>After identifying a target service, the attacker requests a TGS ticket for that service from the Domain Controller using legitimate Kerberos requests.</li><li>The Domain Controller responds with a service ticket encrypted using the password hash of the associated service account.</li><li>The attacker extracts the encrypted portion of the ticket and converts it into a crackable format using tools such as Hashcat or John the Ripper.</li><li>Offline password cracking is then performed in an attempt to recover the service account password without any additional communication with the Domain Controller.</li></ol><p>If the service account password is weak or predictable, the attacker may successfully crack it within a short period of time, potentially leading to privilege escalation or access to sensitive services within the network.</p><p>Kerberoasting is especially dangerous because the requests used during the attack appear legitimate from the perspective of the Kerberos protocol, making malicious activity more difficult to detect.</p><h3>Detection and Mitigation</h3><p>Although Kerberoasting relies on legitimate Kerberos functionality, organizations can still implement several defensive measures to reduce the risk of this attack.</p><p>One of the most effective protections is using strong and complex passwords for service accounts. Since Kerberoasting depends on offline password cracking, long and randomly generated passwords make the attack significantly harder.</p><p>Organizations should also avoid using highly privileged accounts as service accounts whenever possible. Applying the principle of least privilege can reduce the overall impact if a service account becomes compromised.</p><p>Another recommended practice is the use of Group Managed Service Accounts (gMSAs), which automatically manage and rotate strong passwords for services.</p><p>From a detection perspective, defenders can monitor Kerberos-related logs, especially Event ID 4769, which records requests for service tickets. A large number of TGS requests in a short period of time may indicate suspicious activity.</p><p>Additionally, security teams should regularly audit accounts associated with SPNs and identify old or unnecessary service accounts that may expose the environment to risk.</p><p>By combining strong password policies, proper account management, and continuous monitoring, organizations can significantly reduce the effectiveness of Kerberoasting attacks.</p><h3>Conclusion</h3><p>Kerberoasting remains one of the most well-known attacks against Active Directory environments because it abuses legitimate Kerberos functionality and requires only a low-privileged domain account.</p><p>By requesting service tickets associated with SPNs, attackers can obtain encrypted ticket data and attempt to crack service account passwords offline. Weak passwords and poorly managed service accounts can make this attack highly effective and potentially lead to privilege escalation within the network.</p><p>Understanding how Kerberos authentication works, how SPNs are used, and how attackers exploit service tickets is essential for both penetration testers and defenders.</p><p>Although Kerberoasting can be difficult to detect, organizations can reduce the risk by enforcing strong password policies, limiting service account privileges, using managed service accounts, and continuously monitoring Kerberos activity.</p><p>As Active Directory continues to be a critical part of enterprise infrastructure, understanding attacks such as Kerberoasting is an important step toward building stronger defensive security practices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2cc14a23b2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>