<?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 Lahsta on Medium]]></title>
        <description><![CDATA[Stories by Lahsta on Medium]]></description>
        <link>https://medium.com/@lahstaa?source=rss-7361b7dae14d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1OMj8hGtOJs4HAfW0MrQGQ.jpeg</url>
            <title>Stories by Lahsta on Medium</title>
            <link>https://medium.com/@lahstaa?source=rss-7361b7dae14d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 07:29:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lahstaa/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[Buffer Overflow]]></title>
            <link>https://lahstaa.medium.com/buffer-overflow-e6da5f925c2f?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6da5f925c2f</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 05:07:12 GMT</pubDate>
            <atom:updated>2024-10-29T05:07:12.814Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Understanding Buffers</strong></h3><p>A buffer is a shared data structure that facilitates communication between hardware devices or software processes operating at different speeds or with distinct priority levels, allowing for efficient data transfer and flow control.</p><p>Imagine you have a coffee shop. There’s a barista (the <strong>producer</strong>) who makes coffee and a customer (the <strong>consumer</strong>) who orders coffee.</p><ol><li>The Coffee Machine (<strong>Buffer</strong>): The coffee machine can hold only 4 cups of coffee at a time.</li><li>Barista (<strong>Producer</strong>): The barista makes a cup of coffee and puts it in the machine. If the machine is full (4 cups), the barista has to wait until a cup is taken out.</li><li>Customer (<strong>Consumer</strong>): The consumer comes in and orders a cup of coffee. If the machine is empty, the customer has to wait until the barista makes more coffee.</li></ol><p>Now, let’s implement this concept in code. We’ll create a simple simulation of the coffee shop using Python.</p><pre>import threading<br>import time<br>import random<br><br># Buffer (the coffee machine)<br>buffer_size = 4<br>coffee_machine = []<br>buffer_lock = threading.Lock()<br><br># Barista (Producer)<br>def barista():<br>    while True:<br>        coffee = &quot;Coffee&quot;  # Simulate making a cup of coffee<br>        with buffer_lock:<br>            if len(coffee_machine) &lt; buffer_size:<br>                coffee_machine.append(coffee)<br>                print(f&quot;Barista made: {coffee} | Coffee Machine: {coffee_machine}&quot;)<br>            else:<br>                print(&quot;Coffee machine is full, barista is waiting.&quot;)<br>        time.sleep(random.uniform(0.5, 1.5))  # Simulate time taken to make coffee<br><br># Customer (Consumer)<br>def customer():<br>    while True:<br>        with buffer_lock:<br>            if coffee_machine:<br>                served_coffee = coffee_machine.pop(0)<br>                print(f&quot;Customer received: {served_coffee} | Coffee Machine: {coffee_machine}&quot;)<br>            else:<br>                print(&quot;Coffee machine is empty, customer is waiting.&quot;)<br>        time.sleep(random.uniform(1, 2))  # Simulate time taken to drink coffee<br><br># Start barista and customer threads<br>barista_thread = threading.Thread(target=barista)<br>customer_thread = threading.Thread(target=customer)<br><br>barista_thread.start()<br>customer_thread.start()<br><br># Let them run for a while<br>time.sleep(20)<br><br># Stop the threads (in a real application, you&#39;d want a more graceful shutdown)<br>barista_thread.join(timeout=1)<br>customer_thread.join(timeout=1)</pre><p><strong>Explanation:</strong></p><p>Coffee Machine: The “<strong>coffee_machine</strong>” list represents our buffer, holding up to 4 cups.</p><p>Barista: The “<strong>barista</strong>” function makes coffee and puts it in the machine. It waits if the machine is full.</p><p>Customer: The “<strong>customer</strong>” function takes coffee from the machine. It waits if the machine is empty.</p><p>Locking: A “<strong>Lock</strong>” is used to ensure that the coffee machine is accessed safely by one thread at a time.</p><p>Threads: The barista and customer run in separate threads, simulating the coffee-making and coffee-drinking processes simultaneously.</p><p>This example demonstrates how a buffer regulates the flow between the production and consumption of coffee, ensuring that there is no overflow or empty states in the system.</p><h4>Buffer Overflow: When Data Spills Over</h4><p>Buffer overflow is a software vulnerability that occurs when a program writes more data to a buffer than it can accommodate, leading to the corruption of adjacent memory.</p><p>This overflow can be exploited by attackers, who manipulate input data to overwrite critical memory areas, such as return addresses on the stack. By doing so, they can redirect the program’s execution flow to malicious code, potentially gaining unauthorized access to systems and executing arbitrary commands. The consequences of a successful buffer overflow attack can include data corruption, crashes, and complete system compromise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*NFPG3N-uGreVAp6n.gif" /></figure><p>In our coffee shop scenario, the coffee machine can only hold 4 cups of coffee at a time. If the barista keeps brewing coffee without checking how much is already in the machine, they might end up overflowing it, causing coffee to spill everywhere. This overflow could disrupt the entire shop, just like a buffer overflow in software can lead to crashes or security vulnerabilities.</p><p>Now, if a clever customer (think of an attacker) figures out how to trick the barista into making more coffee than the machine can handle, they could cause a real mess. This is similar to how an attacker can exploit a buffer overflow in a program by inputting more data than the system can store, potentially gaining control over the system.</p><p>Now let’s see how this concept translates into code. We’ll simulate a buffer overflow situation in Python.</p><pre>import threading<br>import time<br>import random<br><br># Buffer (the coffee machine)<br>buffer_size = 4<br>coffee_machine = []<br>buffer_lock = threading.Lock()<br><br># Barista (Producer)<br>def barista():<br>    while True:<br>        coffee = &quot;Coffee&quot;  # Simulate making a cup of coffee<br>        with buffer_lock:<br>            # Intentionally allow adding more than buffer_size to simulate overflow<br>            if len(coffee_machine) &lt;= buffer_size:<br>                coffee_machine.append(coffee)<br>                print(f&quot;Barista made: {coffee} | Coffee Machine: {coffee_machine}&quot;)<br>            else:<br>                print(&quot;Coffee machine is full, but barista adds more coffee anyway!&quot;)<br>                # Simulate overflow by adding extra coffee beyond capacity<br>                coffee_machine.append(coffee)  # This represents an overflow<br>                # Add additional dummy entries to represent overflow<br>                coffee_machine.extend([&quot;Overflow Coffee&quot;] * 2)  # Overwriting memory with excess entries<br>        time.sleep(random.uniform(0.5, 1.5))  # Simulate time taken to make coffee<br><br># Customer (Consumer)<br>def customer():<br>    while True:<br>        with buffer_lock:<br>            if coffee_machine:<br>                served_coffee = coffee_machine.pop(0)<br>                print(f&quot;Customer received: {served_coffee} | Coffee Machine: {coffee_machine}&quot;)<br>            else:<br>                print(&quot;Coffee machine is empty, customer is waiting.&quot;)<br>        time.sleep(random.uniform(1, 2))  # Simulate time taken to drink coffee<br><br># Start barista and customer threads<br>barista_thread = threading.Thread(target=barista)<br>customer_thread = threading.Thread(target=customer)<br><br>barista_thread.start()<br>customer_thread.start()<br><br># Let them run for a while<br>time.sleep(20)<br><br># Stop the threads (in a real application, you&#39;d want a more graceful shutdown)<br>barista_thread.join(timeout=1)<br>customer_thread.join(timeout=1)</pre><p><strong>Explanation:</strong></p><p>Buffer (Coffee Machine): The “<strong>coffee_machine</strong>” list represents our buffer, which has a capacity of 4 cups.</p><p>Barista (Producer): The “<strong>barista</strong>” function brews coffee and checks the buffer size. In this case, if the buffer is full, it still adds coffee and even adds dummy entries to simulate an overflow.</p><p>Customer (Consumer): The “<strong>customer</strong>” function takes coffee from the machine. If the machine is empty, the customer waits.</p><p>Threading: The barista and customer operate in separate threads, simulating the simultaneous brewing and consuming of coffee.</p><p>This code illustrates how a buffer overflow can occur in a controlled environment, emphasizing the risks associated with exceeding the limits of a buffer, similar to vulnerabilities found in software applications.</p><h4>Curbing the Overflow</h4><p>To reduce the risk of buffer overflow vulnerabilities, developers can implement a range of effective strategies:</p><p><strong>Bounds Checking</strong>: This involves validating the size of input data before it is written to a buffer. By ensuring that only the allowed amount of data is processed, developers can prevent overflows from occurring.</p><p><strong>Safer Functions</strong>: Instead of using functions that do not check the size of the buffer (like strcpy in C), developers can utilize safer alternatives, such as strncpy, which limit the number of characters copied to the buffer, thereby reducing the risk of overflow.</p><p><strong>Stack Canaries</strong>: A stack canary is a security mechanism that places a small, known value (the canary) next to a buffer on the stack. If an overflow occurs and overwrites the canary, the program can detect this tampering before executing any potentially harmful code, triggering a security response.</p><p><strong>Address Space Layout Randomization (ASLR)</strong>: ASLR is a technique that randomizes the memory addresses used by system and application processes each time they run. This makes it more difficult for attackers to predict where their malicious code will reside, thus mitigating the risk of successfully exploiting buffer overflow vulnerabilities.</p><p>Thank you for reading!</p><p>Remember, just like in a coffee shop, it’s always better to know when to stop brewing</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6da5f925c2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating API Security: Part II]]></title>
            <link>https://lahstaa.medium.com/navigating-api-security-part-ii-4b29c3ab1e19?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b29c3ab1e19</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 25 Jun 2024 15:03:35 GMT</pubDate>
            <atom:updated>2024-06-25T15:14:17.494Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week’s blog introduced the fundamentals of APIs and examined the top 5 vulnerabilities from the OWASP Top 10 API Security Risks. In this week’s post, we will explore the remaining 5 OWASP API vulnerabilities.<br>So let’s get started!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQJvwBSGaoc4eI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExYnl2cHd6dXkxOTEya2c4eG0xM2RhaTNkaXo2cHFiamRvM3VjZnc3MSZlcD12MV9naWZzX3NlYXJjaCZjdD1n%2FQJvwBSGaoc4eI%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZGhsenJ0aWx0NDhwM3d3am96NnhibHJ1dno4dXl4bnM3am12cWZnbSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FQJvwBSGaoc4eI%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="313" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd345527006da0ed1f78c7b279140398/href">https://medium.com/media/fd345527006da0ed1f78c7b279140398/href</a></iframe><p>Since we explored the top 5 API vulnerabilities last week, let’s continue by exploring vulnerabilities number 6 through 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZRbmJhcZbRg6h6fJCYuXA.png" /></figure><blockquote><strong><em>6. Unrestricted Access to Sensitive Business Flows</em></strong></blockquote><blockquote><strong><em>Description:</em></strong><em> Unrestricted access to sensitive business flows occurs when attackers abuse legitimate business workflows through excessive, automated use. This can overwhelm the system and lead to significant disruptions. Common preventive measures like rate limiting and CAPTCHAs are often insufficient, as attackers use techniques such as rapid IP rotation to evade detection. This vulnerability typically stems from flaws in the application logic.</em></blockquote><blockquote><strong><em>Risk Exposure:</em></strong></blockquote><blockquote><em>Loss of critical business activity.</em></blockquote><blockquote><em>Potential revenue loss due to exploitation of system flaws.</em></blockquote><blockquote><strong><em>Examples:</em></strong></blockquote><blockquote><em>Mass, automated ticket purchasing.</em></blockquote><blockquote><em>High-volume referral bonus exploitation.</em></blockquote><blockquote><strong><em>Prevention:</em></strong></blockquote><blockquote><strong><em>1. Identify Critical Business Workflows:</em></strong></blockquote><blockquote><em>Recognize and document workflows that are essential to business operations and could be targeted by automated abuse.</em></blockquote><blockquote><strong><em>2. Implement Fraudulent Traffic Detection and Control:</em></strong></blockquote><blockquote><em>Use advanced algorithms and machine learning techniques to detect patterns of fraudulent activity.</em></blockquote><blockquote><em>Deploy behavior analytics to identify and mitigate automated abuse.</em></blockquote><blockquote><strong><em>3. Set Up and Automate Testing of Control Mechanisms:</em></strong></blockquote><blockquote><em>Regularly test the effectiveness of rate limiting, CAPTCHAs, and other control mechanisms.</em></blockquote><blockquote><em>Integrate automated security testing tools into the CI/CD pipeline to continually assess and enhance the robustness of these controls.</em></blockquote><blockquote><strong><em>7. Server Side Request Forgery (SSRF)</em></strong></blockquote><blockquote><strong><em>Description:</em></strong><em> Server Side Request Forgery (SSRF) occurs when an attacker exploits URL inputs to make unauthorized requests to internal or third-party servers. This can lead to various malicious activities, such as accessing sensitive data or downloading malware.</em></blockquote><blockquote><strong><em>Risk Exposure:</em></strong></blockquote><blockquote><em>SSRF creates a channel for malicious requests, data access, or other fraudulent activities.</em></blockquote><blockquote><em>Potential for data leaks and unauthorized access to internal systems.</em></blockquote><blockquote><strong><em>Examples:</em></strong></blockquote><blockquote><strong><em>Local File Injection (LFI):</em></strong><em> An attacker submits a URL like </em><em>http://localhost/api/user-data to access local files on the server.</em></blockquote><blockquote><strong><em>Malware Download:</em></strong><em> An attacker tricks the server into downloading malware from a malicious site.</em></blockquote><blockquote><strong><em>Prevention:</em></strong></blockquote><blockquote><strong><em>1. Validate and Sanitize All User-Supplied Information:</em></strong></blockquote><blockquote><em>Rigorously validate and sanitize URL parameters and other inputs to prevent injection attacks.</em></blockquote><blockquote><em>Use whitelisting to ensure only allowed URLs and domains are accessed.</em></blockquote><blockquote><strong><em>2. Ensure Communication Only with Trusted Resources:</em></strong></blockquote><blockquote><em>Implement network segmentation to restrict server communication to trusted resources.</em></blockquote><blockquote><em>Use firewalls and access control lists (ACLs) to enforce strict outbound communication policies.</em></blockquote><blockquote><strong><em>3. Test URL Validation Effectiveness:</em></strong></blockquote><blockquote><em>Regularly test the effectiveness of your URL validation mechanisms.</em></blockquote><blockquote><em>Incorporate SSRF detection into automated security testing tools and processes to identify and address vulnerabilities promptly.</em></blockquote><blockquote><strong><em>8. Security Misconfiguration</em></strong></blockquote><blockquote><strong><em>Description:</em></strong><em> Security misconfiguration is a broad category that includes the lack of hardening of unnecessary services and components. Attackers often use bots to scan, detect, and exploit these misconfigurations, leading to severe security risks.</em></blockquote><blockquote><strong><em>Risk Exposure:</em></strong></blockquote><blockquote><em>Misconfigurations can expose sensitive user data.</em></blockquote><blockquote><em>Potential for full server compromise.</em></blockquote><blockquote><strong><em>Examples:</em></strong></blockquote><blockquote><em>Lack of security hardening.</em></blockquote><blockquote><em>Improperly configured permissions.</em></blockquote><blockquote><em>Missing security patches.</em></blockquote><blockquote><em>Unnecessary features enabled.</em></blockquote><blockquote><em>Missing TLS (Transport Layer Security).</em></blockquote><blockquote><em>CORS (Cross-Origin Resource Sharing) policy missing or improperly set.</em></blockquote><blockquote><strong><em>Prevention:</em></strong></blockquote><blockquote><strong><em>1. Implement Hardening Procedures:</em></strong></blockquote><blockquote><em>Disable unnecessary services and features.</em></blockquote><blockquote><em>Ensure all components are configured securely according to best practices.</em></blockquote><blockquote><em>Regularly update and apply security patches.</em></blockquote><blockquote><strong><em>2. Routinely Review Configurations:</em></strong></blockquote><blockquote><em>Periodically audit and review all system configurations to identify and rectify any misconfigurations.</em></blockquote><blockquote><em>Maintain an inventory of all assets and their configurations to facilitate regular reviews.</em></blockquote><blockquote><strong><em>3. Implement Automated, Continuous Security Testing:</em></strong></blockquote><blockquote><em>Use automated security testing tools to continuously monitor and detect misconfigurations.</em></blockquote><blockquote><em>Integrate these tools into the CI/CD pipeline to ensure configurations are secure before deployment.</em></blockquote><blockquote><em>Conduct regular vulnerability assessments and penetration testing to identify potential weaknesses.</em></blockquote><blockquote><strong><em>9. Improper Inventory Management</em></strong></blockquote><blockquote><strong><em>Description:</em></strong><em> Improper inventory management occurs when old, unused API versions, or APIs provided through trusted third parties, are not adequately managed. This can lead to unauthorized access and exploitation of outdated or less secure endpoints.</em></blockquote><blockquote><strong><em>Risk Exposure:</em></strong></blockquote><blockquote><em>Data or account theft via unretired APIs.</em></blockquote><blockquote><em>Exposure of sensitive data via improperly secured third-party APIs.</em></blockquote><blockquote><strong><em>Examples:</em></strong></blockquote><blockquote><em>Old versions of APIs left active.</em></blockquote><blockquote><em>Unpatched endpoints with known vulnerabilities.</em></blockquote><blockquote><em>Endpoints with weaker security measures.</em></blockquote><blockquote><em>Outdated documentation leading to security oversights.</em></blockquote><blockquote><em>Unnecessarily exposed endpoints.</em></blockquote><blockquote><em>API access through third parties not properly managed.</em></blockquote><blockquote><strong><em>Prevention:</em></strong></blockquote><blockquote><strong><em>1. Deploy/Manage All APIs in a Gateway:</em></strong></blockquote><blockquote><em>Use an API gateway to manage and monitor all API traffic.</em></blockquote><blockquote><em>Enforce consistent security policies across all API endpoints.</em></blockquote><blockquote><strong><em>2. Define Rules for Versioning and Retirement:</em></strong></blockquote><blockquote><em>Establish clear guidelines for API versioning and deprecation.</em></blockquote><blockquote><em>Ensure old API versions are retired and removed from production environments promptly.</em></blockquote><blockquote><strong><em>3. Periodically Audit Third-Party Access:</em></strong></blockquote><blockquote><em>Regularly review and audit third-party access to ensure compliance with security policies.</em></blockquote><blockquote><em>Verify that third-party APIs are properly secured and up-to-date.</em></blockquote><blockquote><em>Conduct security assessments of third-party integrations to identify and mitigate potential risks.</em></blockquote><blockquote><strong><em>10. Unsafe Consumption of APIs</em></strong></blockquote><blockquote><strong><em>Description:</em></strong><em> Unsafe consumption of APIs occurs when APIs from third parties, which are generally trusted, are exploited by attackers. These vulnerabilities can then be used to target APIs that rely on these third-party services.</em></blockquote><blockquote><strong><em>Risk Exposure:</em></strong></blockquote><blockquote><em>Data theft and breaches.</em></blockquote><blockquote><em>Account takeovers.</em></blockquote><blockquote><strong><em>Examples:</em></strong></blockquote><blockquote><em>An attacker inserts malicious address data into a validation site used by a client. The client fails to validate the data properly and gets exploited.</em></blockquote><blockquote><em>An attacker compromises a third-party API, causing it to respond with a redirect to a malicious site. The client blindly follows the redirects without validation.</em></blockquote><blockquote><strong><em>Prevention:</em></strong></blockquote><blockquote><strong><em>1. Validate Data Returned by Third-Party APIs:</em></strong></blockquote><blockquote><em>Implement strict validation checks for any data received from third-party APIs.</em></blockquote><blockquote><em>Treat data from third parties as untrusted until it is validated.</em></blockquote><blockquote><strong><em>2. Evaluate Security Controls of Third-Party APIs:</em></strong></blockquote><blockquote><em>Conduct security assessments of third-party APIs before integration.</em></blockquote><blockquote><em>Ensure third-party APIs adhere to robust security standards and practices.</em></blockquote><blockquote><strong><em>3. Encrypt All API Communication:</em></strong></blockquote><blockquote><em>Use TLS to encrypt all communication between APIs to prevent interception and tampering.</em></blockquote><blockquote><em>Ensure encryption is enforced consistently across all endpoints.</em></blockquote><blockquote><strong><em>4. Maintain an Approved List of Known Locations for Integrated APIs:</em></strong></blockquote><blockquote><em>Maintain a whitelist of trusted endpoints that third-party APIs are allowed to redirect to.</em></blockquote><blockquote><em>Implement strict policies to handle redirects and ensure they are only followed if they lead to approved locations.</em></blockquote><p>Effective API security is paramount for modern web and mobile applications. Unrestricted access to sensitive business flows, Server Side Request Forgery (SSRF), security misconfigurations, improper inventory management, and unsafe API consumption is crucial. By implementing strong security measures, conducting regular audits, and maintaining vigilant monitoring, organizations can mitigate risks, safeguard sensitive data, and uphold API integrity. Stay proactive in your security practices to stay ahead of emerging threats and protect your applications effectively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b29c3ab1e19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating API Security]]></title>
            <link>https://lahstaa.medium.com/navigating-api-security-9d5d5dc4dae9?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d5d5dc4dae9</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 08:31:13 GMT</pubDate>
            <atom:updated>2024-06-18T08:31:13.459Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog aims to provide a comprehensive overview of the OWASP Top 10 API Security Risks, offering insights into each risk, its potential impact, and best practices for mitigation. By understanding these risks, developers, security professionals, and stakeholders can better safeguard their applications, ensuring the integrity, confidentiality, and availability of their data.</p><blockquote><em>At its core, an API is a set of rules and protocols that allows one software application to interact with another. It acts as an intermediary, enabling different systems to exchange data and perform actions without needing to understand each other’s internal working.</em></blockquote><h4><em>Let’s take a basic example to learn about API</em></h4><blockquote><em>Imagine you have a friend who is really good at making pizza. You want to have some pizza, but you don’t know how to make it yourself. Instead of trying to figure it out on your own, you ask your friend to make the pizza for you. An API works in a similar way in the world of computers and applications.</em></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FOZ5RMiTtH13YoYjesp%2Fvideo&amp;display_name=GIPHY&amp;url=https%3A%2F%2Fgiphy.com%2Fclips%2Fstudiosoriginals-pizza-party-OZ5RMiTtH13YoYjesp&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FOZ5RMiTtH13YoYjesp%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="480" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/239e8b2215cb02945a1517bfef649074/href">https://medium.com/media/239e8b2215cb02945a1517bfef649074/href</a></iframe><blockquote><em>Think of an API Like a Pizza Delivery Service</em></blockquote><blockquote><strong><em>You</em></strong><em>: The person who wants to order a pizza.</em></blockquote><blockquote><strong><em>Pizza Menu</em></strong><em>: The list of pizzas you can order (like the API’s documentation that tells you what it can do).</em></blockquote><blockquote><strong><em>Phone Call</em></strong><em>: The way you place your order (like making a request to the API).</em></blockquote><blockquote><strong><em>Pizza Shop</em></strong><em>: The place that makes the pizza (like the server or service that the API connects to).</em></blockquote><blockquote><strong><em>Delivery Person</em></strong><em>: The one who brings the pizza to your house (like the API delivering the response).</em></blockquote><h4><em>In this analogy:</em></h4><blockquote><em>You are like the user or application that needs something.</em></blockquote><blockquote><em>The pizza menu is like the API documentation that lists what you can request.</em></blockquote><blockquote><em>The Phone Call is like making a request to the API.</em></blockquote><blockquote><em>The Pizza Shop is like the server or service that processes the request.</em></blockquote><blockquote><em>The Delivery Person is like the API delivering the result back to you.</em></blockquote><blockquote><em>APIs often handle sensitive information, such as personal data, payment details, and confidential business information. Without proper security measures, this data can be intercepted by malicious actors, leading to identity theft, financial loss, and reputational damage.</em></blockquote><blockquote><em>The Open Web Application Security Project (OWASP) has identified the top 10 security risks that is addressed below which is necessary to learn to protect APIs from potential threats.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vXy8tzNbtB1Pg6wi.png" /></figure><blockquote><strong><em>1. Broken Object Level Authorization(BOLA): </em></strong><em>BOLA is the most common and damaging API vulnerability, ranking as the top threat in API security. It occurs when an attacker manipulates APIs to gain access to data or objects that belong to other users. This unauthorized access can result in severe consequences, such as data loss, disclosure, and manipulation. For example, an attacker might authenticate as User A but then retrieve or modify data belonging to User B.</em></blockquote><blockquote><strong><em>Example Scenario</em></strong></blockquote><blockquote><em>An attacker logs into an application as User A. By exploiting a flaw in the API, they can alter the request parameters to access User B’s data. This unauthorized access can happen due to insufficient authorization checks at the object level, allowing the attacker to view or manipulate another user’s information.</em></blockquote><blockquote><strong><em>Consequences of BOLA</em></strong></blockquote><blockquote><strong><em>Data Loss:</em></strong><em> Sensitive information might be deleted or corrupted.</em></blockquote><blockquote><strong><em>Data Disclosure:</em></strong><em> Private data could be exposed to unauthorized individuals.</em></blockquote><blockquote><strong><em>Data Manipulation:</em></strong><em> Information could be altered maliciously, leading to misinformation or fraud.</em></blockquote><blockquote><strong><em>Preventive Measures</em></strong></blockquote><blockquote><strong><em>Define Data Access Policies:</em></strong></blockquote><blockquote><em>Establish clear and detailed data access policies that specify who can access what data and under which circumstances.</em></blockquote><blockquote><em>Ensure that these policies cover all types of data objects and scenarios.</em></blockquote><blockquote><em>Regularly review and update these policies to adapt to new security challenges and changes in the application environment.</em></blockquote><blockquote><strong><em>Enforce Data Access Controls at the Application Logic Layer:</em></strong></blockquote><blockquote><em>Implement robust access control mechanisms within the application logic to enforce data access policies.</em></blockquote><blockquote><em>Use role-based access control (RBAC) or attribute-based access control (ABAC) models to manage permissions dynamically based on user roles or attributes.</em></blockquote><blockquote><em>Ensure that access controls are consistently applied across all API endpoints and actions.</em></blockquote><blockquote><strong><em>Implement Automated Testing to Find BOLA Flaws:</em></strong></blockquote><blockquote><em>Regularly conduct automated security testing using tools designed to detect BOLA vulnerabilities.</em></blockquote><blockquote><em>Incorporate API security testing into the CI/CD pipeline to identify and fix vulnerabilities early in the development process.</em></blockquote><blockquote><em>Use fuzz testing and other dynamic analysis techniques to simulate various attack scenarios and uncover potential flaws.</em></blockquote><blockquote><em>Employ static analysis tools to inspect the codebase for improper access control implementations.</em></blockquote><blockquote><strong><em>2. Broken Authentication: </em></strong><em>Broken Authentication is a critical vulnerability that arises from weak or poorly implemented authentication mechanisms or missing security controls. This vulnerability can lead to severe risks such as account takeovers, data theft, and unauthorized transactions. It encompasses issues such as weak password requirements, credential stuffing, lack of CAPTCHA or rate limiting, exposure of authentication information in URLs, non-validation of token expiration, and insecure password storage.</em></blockquote><blockquote><strong><em>Examples of Broken Authentication</em></strong></blockquote><blockquote><strong><em>Weak Password Requirements:</em></strong><em> Allowing users to create simple, easily guessable passwords.</em></blockquote><blockquote><strong><em>Credential Stuffing:</em></strong><em> Attackers use brute force to guess usernames and passwords, often using leaked credentials from other breaches.</em></blockquote><blockquote><strong><em>Lack of CAPTCHA/Rate Limiting/Lockout Mechanisms:</em></strong><em> Failing to implement protections against automated login attempts.</em></blockquote><blockquote><strong><em>Auth Information in URLs:</em></strong><em> Including tokens or passwords in URLs, which can be logged or exposed.</em></blockquote><blockquote><strong><em>Non-validation of Token Expiration:</em></strong><em> Allowing the use of expired tokens, enabling unauthorized access.</em></blockquote><blockquote><strong><em>Insecure Password Storage:</em></strong><em> Storing passwords in plain text or using weak hashing algorithms.</em></blockquote><blockquote><strong><em>Risk Exposure</em></strong></blockquote><blockquote><strong><em>Account Takeover:</em></strong><em> Attackers gain unauthorized access to user accounts.</em></blockquote><blockquote><strong><em>Data Theft:</em></strong><em> Sensitive information is stolen, leading to privacy breaches.</em></blockquote><blockquote><strong><em>Unauthorized Transactions:</em></strong><em> Malicious actors perform transactions without the user’s consent.</em></blockquote><blockquote><strong><em>Preventive Measures</em></strong></blockquote><blockquote><strong><em>Define Authentication Policies and Standards:</em></strong></blockquote><blockquote><em>Establish comprehensive authentication policies that adhere to industry best practices.</em></blockquote><blockquote><em>Require strong, complex passwords that include a mix of characters, numbers, and symbols.</em></blockquote><blockquote><em>Enforce regular password changes and prohibit the reuse of old passwords.</em></blockquote><blockquote><em>Implement multi-factor authentication (MFA) to add an extra layer of security.</em></blockquote><blockquote><strong><em>Implement Continuous Testing:</em></strong></blockquote><blockquote><em>Regularly conduct automated and manual testing to identify and address authentication vulnerabilities.</em></blockquote><blockquote><em>Integrate security testing into the CI/CD pipeline to catch issues early in the development process.</em></blockquote><blockquote><em>Use penetration testing to simulate real-world attack scenarios and identify weaknesses.</em></blockquote><blockquote><strong><em>3. Broken Object Property Level Authorization:</em></strong><em> Broken Object Property Level Authorization is a vulnerability that occurs when endpoints allow unauthorized reading or modifying of object properties. This includes the ability to update object elements through “mass assignment” and revealing unnecessary sensitive data through “excessive data exposure.”</em></blockquote><blockquote><strong><em>Risk Exposure</em></strong></blockquote><blockquote><strong><em>Revealing Protected User Data:</em></strong><em> Unauthorized access to sensitive information can lead to privacy breaches and potential misuse of data.</em></blockquote><blockquote><strong><em>Examples</em></strong></blockquote><blockquote><strong><em>Mass Assignment:</em></strong><em> A user can set properties they shouldn’t be able to, such as changing their account type to “premium.”</em></blockquote><blockquote><strong><em>Excessive Data Exposure:</em></strong><em> An endpoint returns more information than necessary, such as returning a user’s name, email, address, and ID when only a username is required.</em></blockquote><blockquote><strong><em>Preventive Measures</em></strong></blockquote><blockquote><strong><em>Ensure Users Can Only Access Legitimate, Permitted Fields:</em></strong></blockquote><blockquote><em>Implement strict validation and authorization checks to ensure users can only read or modify fields they are permitted to access.</em></blockquote><blockquote><em>Use whitelisting to specify which properties can be updated by users, preventing unauthorized changes to sensitive fields.</em></blockquote><blockquote><strong><em>Return Only the Minimum Amount of Data Required:</em></strong></blockquote><blockquote><em>Limit the data returned by endpoints to only what is necessary for the use case. This minimizes the risk of exposing sensitive information.</em></blockquote><blockquote><em>Use response filtering to exclude unnecessary data from API responses.</em></blockquote><blockquote><strong><em>4. Unrestricted Resource Consumption: </em></strong><em>Unrestricted Resource Consumption, formerly known as “Lack of Resources and Rate Limiting,” refers to the abuse of APIs due to high volumes of API calls, large requests, and other resource-intensive operations. This vulnerability can lead to significant risks such as denial of service (DoS), performance degradation, and mass data harvesting.</em></blockquote><blockquote><strong><em>Risk Exposure</em></strong></blockquote><blockquote><strong><em>Denial of Service (DoS):</em></strong><em> Overloading the system can cause it to become unresponsive, denying service to legitimate users.</em></blockquote><blockquote><strong><em>Performance Impact:</em></strong><em> High resource consumption can slow down the application, negatively affecting user experience.</em></blockquote><blockquote><strong><em>Mass Data Harvesting:</em></strong><em> Excessive API calls can be used to collect large amounts of data, potentially violating privacy and data protection regulations.</em></blockquote><blockquote><strong><em>Examples</em></strong></blockquote><blockquote><strong><em>Missing/Inadequate Rate Controls:</em></strong><em> Absence of limits on the number of API requests a user can make within a certain period.</em></blockquote><blockquote><strong><em>Execution Timeouts:</em></strong><em> Failure to limit the time an API request can run, leading to prolonged resource usage.</em></blockquote><blockquote><strong><em>Max Allocable Memory:</em></strong><em> Lack of restrictions on the amount of memory an API request can consume.</em></blockquote><blockquote><strong><em>Max Number of Files/Upload Size:</em></strong><em> Not limiting the number or size of files that can be uploaded in a single request.</em></blockquote><blockquote><strong><em>Excessive Operations in Single Request:</em></strong><em> Allowing too many operations to be performed in a single API call.</em></blockquote><blockquote><strong><em>Excessive Records Returned in Single Request:</em></strong><em> Returning too many records in response to a single API request, consuming significant resources.</em></blockquote><blockquote><strong><em>Preventive Measures</em></strong></blockquote><blockquote><strong><em>Implement Traffic Controls:</em></strong></blockquote><blockquote><strong><em>Rate Limiting:</em></strong><em> Set limits on the number of API requests a user can make in a given time frame to prevent abuse.</em></blockquote><blockquote><strong><em>Throttling:</em></strong><em> Gradually slow down the response rate for users who exceed usage limits rather than blocking them immediately.</em></blockquote><blockquote><strong><em>Quotas:</em></strong><em> Establish quotas to limit the total resource consumption by a user over a specified period.</em></blockquote><blockquote><strong><em>Test Effectiveness of Controls:</em></strong></blockquote><blockquote><strong><em>Load Testing:</em></strong><em> Perform load testing to ensure the application can handle high volumes of traffic without performance degradation.</em></blockquote><blockquote><strong><em>Stress Testing:</em></strong><em> Simulate extreme conditions to test the application’s robustness and its ability to handle resource-intensive operations.</em></blockquote><blockquote><strong><em>Monitoring and Alerts:</em></strong><em> Continuously monitor API usage and set up alerts for unusual patterns or spikes in resource consumption.</em></blockquote><blockquote><strong><em>5. Broken Function Level Authorization:</em></strong><em> Broken Function Level Authorization occurs when API endpoints allow unauthorized access to functions that modify objects, such as creating, updating, or deleting them. This vulnerability often involves replacing passive methods (e.g., GET) with active methods (e.g., PUT, DELETE) to perform unauthorized actions.</em></blockquote><blockquote><strong><em>Risk Exposure</em></strong></blockquote><blockquote><strong><em>Privilege Escalation:</em></strong><em> Attackers may use this vulnerability to gain higher-level access or perform actions beyond their intended permissions.</em></blockquote><blockquote><strong><em>Unauthorized Modifications:</em></strong><em> Sensitive account details and data can be improperly modified, leading to significant security breaches.</em></blockquote><blockquote><strong><em>Examples</em></strong></blockquote><blockquote><strong><em>Modifying Parameters:</em></strong><em> Changing user roles to escalate privileges, such as setting “role = admin.”</em></blockquote><blockquote><strong><em>Deleting Data:</em></strong><em> Removing important records, like deleting an invoice.</em></blockquote><blockquote><strong><em>Altering Account Information:</em></strong><em> Modifying account details, such as setting an account balance to $0.</em></blockquote><blockquote><strong><em>Preventive Measures</em></strong></blockquote><blockquote><strong><em>Identify and Protect High-Sensitivity Functions:</em></strong></blockquote><blockquote><strong><em>Function Sensitivity Assessment:</em></strong><em> Identify API functions that expose high-sensitivity capabilities, such as user role management, financial transactions, and critical data modifications.</em></blockquote><blockquote><strong><em>Access Controls:</em></strong><em> Implement strict access controls to ensure only authorized users can access high-sensitivity functions.</em></blockquote><blockquote><strong><em>Role-Based Access Control (RBAC):</em></strong><em> Use RBAC to restrict access to sensitive functions based on user roles.</em></blockquote><blockquote><strong><em>Implement Continuous Release Testing:</em></strong></blockquote><blockquote><strong><em>Automated Testing:</em></strong><em> Regularly conduct automated tests to verify that API endpoints enforce proper authorization rules.</em></blockquote><blockquote><strong><em>Behavior Testing:</em></strong><em> Test the behavior of API endpoints under various scenarios to ensure they do not allow unauthorized access or actions.</em></blockquote><blockquote><strong><em>Security Audits:</em></strong><em> Perform regular security audits and code reviews to identify and fix authorization flaws.</em></blockquote><p>This concludes our detailed examination of the top 5 API security risks: Broken Object Level Authorization (BOLA), Broken Authentication, Broken Object Property Level Authorization, Unrestricted Resource Consumption, and Broken Function Level Authorization. By understanding these vulnerabilities and implementing the preventive measures discussed, organizations can significantly enhance their API security posture.</p><p>Stay tuned for the next blog, where we will continue to explore the next five critical API security risks. Protecting your APIs is an ongoing process, and being informed is the first step towards a robust security strategy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d5d5dc4dae9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Polyglot Files]]></title>
            <link>https://lahstaa.medium.com/understanding-polyglot-files-5ebdb830977c?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ebdb830977c</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 11 Jun 2024 09:33:27 GMT</pubDate>
            <atom:updated>2024-06-11T09:33:27.650Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, we’ll delve into the fascinating world of polyglot files, exploring their creation, their role in bypassing security measures, and how security professionals needs to stay ahead of cyber criminals.</p><h4>What are Polyglots?</h4><blockquote><em>In the context of cybersecurity, a polyglot file is a type of file that exhibits characteristics of multiple file formats simultaneously, allowing it to be interpreted validly in different ways depending on the context or application reading it. These files act like chameleons, seamlessly transitioning between formats to exploit vulnerabilities or evade detection mechanisms.</em></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxThuWmOkO0SvRprLXy%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxThuWmOkO0SvRprLXy%2Fgiphy.gif%3Fcid%3D790b7611j308aj5zrqf4qk37oqulxwl8q9g6s4pxl81bx8af%26ep%3Dv1_gifs_search%26rid%3Dgiphy.gif%26ct%3Dg&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbXo1MWxuMzJ6dGZieGdyOTJxNTdiYTBlNmw0bXZkeDE2cnd3dnlmeSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FxThuWmOkO0SvRprLXy%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecc2810878f2ea591c485f710262306c/href">https://medium.com/media/ecc2810878f2ea591c485f710262306c/href</a></iframe><blockquote><em>A polyglot file can, for example, be recognized as a valid image file (e.g., PNG or JPEG) by image viewers while simultaneously being identified as a valid executable (e.g., PE or ELF) by an operating system. This duality enables attackers to bypass security filters, as the same file may pass as innocuous in one context while executing malicious code in another.</em></blockquote><blockquote><em>Polyglot files leverage the structural flexibility and parsing mechanisms of different file formats. Since many file formats have certain portions of their structure that are either ignored or treated as arbitrary data, malicious actors can insert code or data from one format into these gaps, creating a file that is valid under multiple specifications. This ability makes polyglot files particularly insidious and challenging to detect, as traditional security tools may not recognize the multifaceted nature of these files.</em></blockquote><blockquote><em>But these polyglot files are always not created with malicious intent. A well-known example of a benign polyglot file is a Java Archive (JAR) file, which is fundamentally a ZIP file. JAR files are extensively utilized in software development for packaging Java classes and associated resources, illustrating that polyglot files can serve legitimate and practical functions. The dual-format nature of these files is not inherently harmful; their potential threat is determined by how they are utilized.</em></blockquote><h4>One can find the common polyglot files format in the following link:</h4><blockquote><a href="https://raw.githubusercontent.com/Polydet/polyglot-database/master/README.md"><em>https://raw.githubusercontent.com/Polydet/polyglot-database/master/README.md</em></a></blockquote><h4><strong>Crafting Polyglot Files</strong></h4><blockquote><strong><em>Step 1: Understanding the Target Formats</em></strong></blockquote><blockquote><em>The first step is to gain a comprehensive understanding of the file specifications for the target formats.</em></blockquote><blockquote><em>For example, if you’re creating a GIF and RAR polyglot (GIFAR), you need to be familiar with the structural requirements of both GIF and RAR files.</em></blockquote><blockquote><em>Key elements to consider include header information, metadata requirements, and footer or end-of-file markers.</em></blockquote><blockquote><strong><em>Step 2: Selecting a Common Ground</em></strong></blockquote><blockquote><em>Identify a segment within the file structures that can act as a common ground.</em></blockquote><blockquote><em>This is often at the beginning of the file, where you can place a header that is valid for both formats. For instance, GIF files start with the signature “GIF89a” or “GIF87a,” while RAR archives begin with “Rar!” followed by version and archive flags.</em></blockquote><blockquote><em>The challenge is to construct a header that both formats will accept or to begin with one format and cleverly insert the other without corrupting the initial format.</em></blockquote><blockquote><strong><em>Step 3: Embedding Dual Functionality</em></strong></blockquote><blockquote><em>To create a GIFAR, typically, you would start by creating a valid GIF file, as the GIF format allows for “garbage” data before the actual image data starts.</em></blockquote><blockquote><em>You can then append a RAR archive to the end of the GIF. The key is to ensure that the RAR archive doesn’t interfere with the GIF’s functionality and vice versa.</em></blockquote><blockquote><em>Tools like RAR can be used to create the archive, and careful manipulation ensures the archive’s data doesn’t make the GIF unreadable.</em></blockquote><blockquote><strong><em>Step 4: Testing Across Environments</em></strong></blockquote><blockquote><em>The created file must be tested in various environments to ensure it maintains its polyglot nature.</em></blockquote><blockquote><em>This involves opening the file as a GIF in image viewers and as a RAR file in archive managers.</em></blockquote><blockquote><em>Success depends on the file being correctly recognized and functioning as intended in both contexts.</em></blockquote><h4>Preventive Measures against Polyglot files</h4><blockquote><em>Only relying on file extensions or MIME types for validation is inadequate. Organizations should implement thorough validation techniques that examine the file content more deeply. These include:</em></blockquote><blockquote><strong><em>Magic Number Inspection:</em></strong><em> Move beyond extensions to inspect the file’s magic numbers, which are unique sequences that identify the file type accurately.</em></blockquote><blockquote><strong><em>Content-Type Sniffing: </em></strong><em>Evaluate the actual content of a file to determine its type, rather than trusting the user-provided file extension or MIME type.</em></blockquote><blockquote><em>In addition, establishing and enforcing strict policies on the types of files that can be uploaded or processed can help reduce the risk of polyglot file attacks. However, this approach should be used in conjunction with other strategies, as polyglot files can imitate permissible file types</em>.</blockquote><p>Thank you for joining in exploring the fascinating and complex world of polyglot files. These unique files, capable of existing in multiple formats simultaneously, present both practical uses and significant security challenges. By understanding their structure and potential risks, we can better appreciate the need for comprehensive validation techniques and robust security policies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ebdb830977c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snapped Phish-ing Line : Try Hack Me Walkthrough]]></title>
            <link>https://lahstaa.medium.com/snapped-phish-ing-line-try-hack-me-walkthrough-6242a36a6623?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6242a36a6623</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 16:27:48 GMT</pubDate>
            <atom:updated>2024-06-04T16:28:53.140Z</atom:updated>
            <content:encoded><![CDATA[<h3>Snapped Phish-ing Line : Try Hack Me Walkthrough</h3><p>Welcome to the “Snapped Phish-ing Line” walkthrough for TryHackMe! The original room link is available here: <a href="https://tryhackme.com/r/room/snappedphishingline">https://tryhackme.com/r/room/snappedphishingline</a> .</p><p>To begin the challenge, access the “start challenge” function. This will provide us with a built-in Kali virtual machine that we can use to complete the challenge tasks.</p><blockquote>The scenario puts you in the shoes of an IT worker at SwiftSpend Financial. It&#39;s a normal day until employees report a strange email. Some fell for it and can&#39;t log in anymore! Your mission is to figure out what&#39;s happening by:</blockquote><blockquote>Checking out the emails your colleagues received.</blockquote><blockquote>Examining the suspicious link in the email by opening it in Firefox (but be careful, do this in a safe isolated environment!).</blockquote><blockquote>Downloading the fake website files the attacker used (phishing kit).</blockquote><blockquote>Using special tools to search for info about the attacker online (CTI stands for Cyber Threat Intelligence).</blockquote><blockquote>Analyzing the downloaded files (phishing kit) to learn more about the attacker.</blockquote><p><strong>Note: </strong>The phishing emails to be analysed are under the <strong><em>phish-emails</em></strong> directory on the Desktop.</p><p>Alright, time to begin the investigation.</p><p>When you start the challenge, you’ll be presented with a ready-made virtual machine pre-configured with Kali Linux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*laRuJ4vkgijMOHSUOI8zCg.png" /><figcaption>Starting the challenge machine</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qS7jC2o9dDYIT3FdfyTrzg.png" /><figcaption>Accessing the machine</figcaption></figure><p>We’ll be seeing a computer screen pretending to be Mr. Damian Hall’s desktop. We’ll be logged in as if we are him. On the desktop, there’s a folder labelled “phishemails” that might be relevant to our investigation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rr3eU22JHIA3_GgR3am4YQ.png" /></figure><p>Opening the “phishemails” folder, we find five emails that appear to be phishing attempts sent to employees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxQgZKQ-d1p9LwTlK9ReOQ.png" /></figure><p><strong><em>Who is the individual who received an email attachment containing a PDF?</em></strong></p><blockquote><em>In order to determine the answer, we must investigate all five of the phishing emails that we previously discovered, maybe identifying the one with the attached PDF and on doing so it reveals “</em><strong><em>William McClean</em></strong><em>” as the recipient of the attached PDF email.</em></blockquote><p><strong><em>What email address was used by the adversary to send the phishing emails?</em></strong></p><blockquote><em>Examining the same email, we discover that </em><strong><em>“Accounts.Payable@groupmarketingonline.icu” </em></strong><em>was the email address that the adversary used to send the phishing emails.</em></blockquote><p><strong><em>What is the redirection URL to the phishing page for the individual Zoe Duncan? (defanged format)</em></strong></p><blockquote><em>Defanging is a process that makes URLs safe. This means we can share them or look into them without worrying about any risks.</em></blockquote><blockquote><em>To analyze the email sent to “Zoe Duncan,” first note that it contains an attached HTML file and mentions a redirection URL. Click on the attachment and save it. Open the saved file with a text editor, then copy the redirection URL, ensuring you exclude any apostrophes or quotation marks.</em></blockquote><blockquote><em>Next, open the Firefox browser in the provided local virtual machine. We’ll find the CyberChef tool bookmarked for convenience.</em></blockquote><blockquote><em>Launch CyberChef, then search for the “defang” operation under the “Operations” tab. Drag the “Defang URL” operation into the “Recipe” area and paste the copied URL into the input field.</em></blockquote><blockquote><em>The defanged URL will appear in the output.</em><strong><em>“hxxp[://]kennaroads[.]buzz/data/Update365/office365/40e7baa2f826a57fcf04e5202526f8bd/?email=zoe[.]duncan@swiftspend[.]finance&amp;error”</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHbss06rsjf9vpLwxF1lLQ.png" /><figcaption>Phishing email containing the file with .html extension</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F11Y6CAAMVlEzkDygKdYLA.png" /><figcaption>Examining the redirect path from the .html file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovXFy6lAqlK8dzPo0NQyLw.png" /><figcaption>Using the CyberChef tool to Defang the URL</figcaption></figure><p><strong><em>What is the URL to the .zip archive of the phishing kit? (defanged format)</em></strong></p><blockquote><em>The defanged redirecting URL points to “kennaroads.buzz.” When we visit this site, the homepage might not catch interest.Instead, pay attention to the URL’s directories, especially “/data.” Go to “kennaroads.buzz/data” and look for the zip archive there.Right-click on the archive, copy its URL, and defang it using CyberChef which will provide the answer </em><strong><em>“hxxp[://]kennaroads[.]buzz/data/Update365[.]zip”.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-XE8xvAH-ugj35cCc-x6RA.png" /><figcaption>Redirecting URL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8I9q42vTKnIGzY9nyUtLQ.png" /><figcaption>Finding different directories of the URL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p85twVE5CZFTu0-1nxUIBg.png" /><figcaption>The URL that provides the zip file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qFvx_hibSBTBnPgh3GCJCg.png" /><figcaption>Defanging the URL that provides the zip file in CyberChef tool</figcaption></figure><p><strong><em>What is the SHA256 hash of the phishing kit archive?</em></strong></p><blockquote><em>To find the hash of the file, download it and we use the command </em><strong><em>sha256sum &quot;filename&quot;</em></strong><em>.</em></blockquote><blockquote><em>This will give us the hash: </em><strong>ba3c15267393419eb08c7b2652b8b6b39b406ef300ae8a18fee4d16b19ac9686</strong><em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*kayyd17dF8wBRWXohdi35w.png" /></figure><p><strong><em>When was the phishing kit archive first submitted? (format: YYYY-MM-DD HH:MM:SS UTC)</em></strong></p><blockquote><em>We must utilise our local system to obtain the necessary data because the pre-built Kali does not have internet connectivity. To determine the first submitted date, we may use the hash we discovered in the virus total, which returns the answer </em><strong><em>“2020–04–08 21:55:50 UTC”.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-V81WghNW0rX8WQ4FjpdeQ.png" /></figure><p><strong><em>When was the SSL certificate the phishing domain used to host the phishing kit archive first logged? (format: YYYY-MM-DD)</em></strong></p><blockquote><em>Knowing that the domain is “kennaroads.buzz,” we may use a tool such as Threatbook CTI to obtain information on the initial data to be registered for the phishing domain, which is what was utilised to host the phishing kit archive. This gives us the result</em><strong><em> “2020–06–25&quot;.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*pKAiUNavI9NLfWiTjL-Kfw.png" /></figure><p><strong><em>What was the email address of the user who submitted their password twice?</em></strong></p><blockquote><em>While searching for directories and subdirectories, we might have discovered the existence of a directory called log.txt. Upon entering this directory, we could see that </em><strong><em>“michael.ascot@swiftspend.finance”</em></strong><em> had twice entered their password.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBc4THVranjU9S2n3Hnt8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jBwBKpIr5MRgZFih10kDQ.png" /></figure><p><strong><em>What was the email address used by the adversary to collect compromised credentials?</em></strong></p><blockquote><em>Inside the zip archive wehen look for a file named “submit.php.” This script handles emailing the stolen credentials to the attacker. The email address used in the script was found to be</em><strong><em> “m3npat@yandex.com”</em></strong><em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*AwQ0RJd7n_KKvnt2Ifesrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XmjwOKQSEnzXIs9aLgcl5g.png" /></figure><p><strong><em>The adversary used other email addresses in the obtained phishing kit. What is the email address that ends in “@gmail.com”?</em></strong></p><blockquote><em>To find email addresses in the obtained phishing kit, we use a command like </em><strong>grep -r &quot;@gmail.com&quot;</strong><em> to search for any content containing Gmail addresses within the directory that holds the phishing kit. This will yield the result </em><strong><em>&quot;jamestanner2299@gmail.com&quot;.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJAFbPTKVskGm2y2wmW1wA.png" /></figure><p><strong><em>What is the hidden flag?</em></strong></p><blockquote><em>We may find nothing of use while looking through the viewable directories and zip archive. The task does recommend changing the phishing URL, though. Try manually brute-forcing the URL</em><strong><em> “kennaroads.buzz/data/Update365/office365/flag.txt”</em></strong><em> until we find something noteworthy. <br>Paste the string copied from “flag.txt” into CyberChef. It seems to be a string that is encoded in base 64. To decode it, use the relevant CyberChef operation. <br>The flag </em><strong><em>“THM{pL4y_w1Th_tH3_URL}”</em></strong><em> can be revealed by performing the reverse operation on it since it is reversed.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJeuuJwdgOz8eb2jpHdIrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-QxT0PilpMavThQuVja1w.png" /></figure><p>This challenge is a great way to learn how to spot and stop phishing attacks. By following these steps and improving your investigation skills, we can help protect organization from these scams and become a cybersecurity hero.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6242a36a6623" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting XXE via Image File Upload: A Step-by-Step Walkthrough]]></title>
            <link>https://lahstaa.medium.com/exploiting-xxe-via-image-file-upload-a-step-by-step-walkthrough-367da9be825c?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/367da9be825c</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 02 Apr 2024 10:57:07 GMT</pubDate>
            <atom:updated>2024-04-02T10:57:07.327Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog article explores exploiting XXE vulnerabilities through image uploads using Web Security Academy’s Portswigger Lab. Understanding how such attacks work allows one to better protect themselves and their websites from cyber threats. So let’s look in and discover the mysteries of XXE attacks through image uploads together!</p><p><strong>Learning Path:</strong></p><p><a href="https://portswigger.net/web-security/xxe/lab-xxe-via-file-upload">Lab: Exploiting XXE via image file upload</a></p><p><strong>Lab description:</strong></p><p>This lab lets users attach avatars to comments and uses the Apache Batik library to process avatar image files.</p><p>To solve the lab, upload an image that displays the contents of the /etc/hostname file after processing. Then use the &quot;Submit solution&quot; button to submit the value of the server hostname.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*G-yzwreSxLEdVp1t129J1Q.png" /></figure><h3>STEPS:</h3><p><strong>Step 1:</strong> Upon first accessing the website, we can see that there is a page where we may explore the blog and leave comments with image files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnHxSgoS1rLQESYcB02dyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zdp5LumjdFeSXNiLJGWafA.png" /></figure><p><strong>Step 2: </strong>Now we’ll try to upload an svg image file, which we may get from the following URL:</p><p><a href="https://en.wikipedia.org/wiki/SVG#/media/File:SVG_Logo.svg">“https://en.wikipedia.org/wiki/SVG#/media/File:SVG_Logo.svg</a>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9OmyXxKmP3QKrLEdLva3vw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DS_-9idw6O6g7BbULPQ9vQ.png" /></figure><p><strong>Step 3: </strong>Now we’ll use Burp Suite to intercept the POST request and post the comment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SS-Tinw6TrY33YvIZSg68g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PzWRW61AzhDriCcWkiTcBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*7GKCvqxjUcJgVNc7lQi_wg.png" /></figure><p><strong>Step 4: </strong>Then, we can see that our comment was successfully uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V8ea3LSNgxGTdllEopc4dA.png" /></figure><p><strong>Step 5: </strong>Now, we’ll try to add payload to the body of the svg file, which can be located at the following URL:</p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XXE%20Injection#xxe-inside-svg">“https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XXE%20Injection#xxe-inside-svg</a>”</p><p>In the XML document payload, we define an external object named “xxe” that refers to the /etc/hostname file, which normally provides the system’s hostname. When this XML document is parsed, the entity reference &amp;xxe; is substituted with the contents of the /etc/hostname file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JmNQo0VkQ8jXTImy6fVgqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B6F078fdZcZKJpnuqy5WdA.png" /></figure><p><strong>Step 6: </strong>The picture has been modified, and the content of /etc/hostname can be seen in the avatar section, allowing us to solve the lab after submitting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4CDQGpt8pmZR8itQaLwRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-yHnKjzM02fOb5a9TqSlQ.png" /></figure><p>So, as we wrap off our inquiry into XXE vulnerabilities via picture uploads, it’s clear that understanding about these threats is critical to keeping your website safe from cyber bad guys. We learned a lot from analysing XXE attacks using examples from the Web Security Academy’s PortSwigger Lab. It’s surprising how something as simple as sharing a picture can be dangerous!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=367da9be825c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Client Side Desync Attack (CL.0 Request Smuggling)]]></title>
            <link>https://lahstaa.medium.com/understanding-the-client-side-desync-attack-cl-0-request-smuggling-1f56964f74c7?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f56964f74c7</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 26 Mar 2024 14:50:39 GMT</pubDate>
            <atom:updated>2024-03-26T14:50:39.907Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey there, fellow web explorer! Ever heard of CL.0 Request Smuggling? It’s like when two servers are chatting online but can’t agree on when to stop listening. Total chaos, right?</p><p>In this blog, we’re digging into CL.0 Request Smuggling. We’ll break down what it is, why it’s a big deal, and how to stay safe from its tricks. Get ready for a wild ride through the world of web security! Let’s jump in and explore together!</p><h3><strong>CL.0 Request Smuggling</strong></h3><p>Imagine you have two people passing messages between them. One person follows a rule where they stop listening after hearing a certain number of words in a message (let’s say 10 words). The other person stops listening only when the speaker finishes talking, regardless of the number of words.</p><p>Now, imagine someone sends a message where they say 5 words, pause, and then say 10 more words. The first person stops listening after the first 10 words, thinking the message is over. But the second person keeps listening until the speaker finishes completely.</p><p>This difference in how they decide when a message ends can cause confusion and create an opportunity for manipulation. Even if the message is split into parts, the second person might misunderstand where it ends, leading to errors or even exploitation.</p><p>In the digital world, servers communicate with each other similarly when handling requests. Sometimes, there can be confusion about when one request ends and another begins. This confusion can happen because of inconsistencies in how servers read certain instructions (like the Content-Length header).</p><p>For example, if one server ignores the length of a message (Content-Length), assuming it ends after the headers, while the other server waits for a specific length of message, it can lead to issues. The first server might think the message is over earlier than the second server does, causing a discrepancy that could be exploited by hackers.</p><h4><strong>Hands-on:</strong></h4><p>Now we will cover how to perform the CL.0 request smuggling exercise from PortSwigger labs in this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*tslrH8PmkEJzZN_4XSyUVw.png" /></figure><p><strong>Learning Path:</strong></p><p><a href="https://portswigger.net/web-security/request-smuggling/browser/cl-0/lab-cl-0-request-smuggling">Lab: CL.0 request smuggling | Web Security Academy</a></p><p><strong>Lab description:</strong></p><p>This lab is vulnerable to CL.0 request smuggling attacks. The back-end server ignores the Content-Length header on requests to some endpoints.</p><p>To solve the lab, identify a vulnerable endpoint, smuggle a request to the back-end to access to the admin panel at /admin, then delete the user carlos.</p><h4><strong>STEPS:</strong></h4><blockquote>Step 1: Upon first viewing the website, the admin panel is visible.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OL7IRVNgSle6oki9zrpVEg.png" /></figure><blockquote>Step 2: During our attempt to access the panel. The lab requires us to visit the admin panel and remove the “Carlos” user, however the path to the admin is restricted.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMqF6FpheOFJK1DUeitAWQ.png" /></figure><blockquote>Step 3: We will now switch to the HTTP history of the burp proxy and submit the GET request to the burp repeater.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*gDNp9GWupGb5AENysopEEg.png" /></figure><blockquote>Step 4: Next, we’ll switch the request method from GET to POST and modify the request attributes to HTTP/1.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*5uk8GEIO2lUkVeTyxSrfGA.png" /></figure><blockquote>Step 5: Next, we’ll include a prefix for getting arbitary requests.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*QDxD3O7J6EFP9Vc0QI79OQ.png" /></figure><blockquote>Step 6: We are going to submit another standard GET request to Burp repeater from the Burp proxy HTTP history now.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*yS4k_O55W69kSmOkDQkPbA.png" /></figure><blockquote>Step 7: Next, we’ll alter the request attribute to match the standard HTTP/1 request.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*-TmgKkBoTeareV1iO3lxVA.png" /></figure><blockquote>Step 8: Next, we’ll combine the attack request and the normal request into a new group as single connection.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*09eNbN-9COpVjb2IyXRWsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*NBhUNBlj1D9hbPsSaf8uWw.png" /></figure><blockquote>Step 9: After that, we will send the sequence and modify the attack request’s connection header to keep alive. When we check the responses, the attack request receives a 200 response while the normal request receives a 404 response, which indicates the back-end server is not responding to requests with a Content-Length of requests.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*jHpJeHuuRfSS6h0ulQmitQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*9bHxNlR-Tol9qik3rUUPgg.png" /></figure><blockquote>Step 10: Additionally, adding the admin path to the attack request results in a 200 response with the path /admin/delete?username=carlos.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*TCe0GLwID21ho6T75Qv5_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*p_zDkAR6O7IdakCWPdmpAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*KsYNd8rNIVf2FnQ8ihCmrQ.png" /></figure><blockquote>Step 11: Next, it responds with 200 with the deletion of the carlos user, resolving the lab, when we send a request to GET /admin/delete?username=carlos.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*MNu9DKM_uWNYuy-k1UNInw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQ1BQ11F0VGfTm9r36eRaA.png" /></figure><p>That wraps up our journey into CL.0 Request Smuggling! It might sound tricky, but staying safe online is all about learning these little quirks. Keep your guard up, update your stuff, and keep on exploring the web safely. See you next time, and remember: stay safe out there!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f56964f74c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cracking the Risk Assessment Code: Qualitative vs. Quantitative Risk Assessment]]></title>
            <link>https://lahstaa.medium.com/cracking-the-risk-assessment-code-qualitative-vs-quantitative-risk-assessment-6f17f893e4c8?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f17f893e4c8</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 09:58:38 GMT</pubDate>
            <atom:updated>2024-03-19T09:58:38.735Z</atom:updated>
            <content:encoded><![CDATA[<p>Greetings! Today, we’re diving into a topic that’s pretty important but often a bit confusing: qualitative and quantitative risk assessment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*37vUSlFyLXMXCVcz-220HA.gif" /></figure><blockquote><strong><em>Risk Assessment</em></strong></blockquote><blockquote><em>In anything we do, there’s always a chance something might go wrong. Risk assessment is basically a structured way of looking at what could go wrong in a project, business, or any situation, and figuring out how bad it could be if it does. It involves thinking about things like how likely something is to happen and what kind of impact it could have. It is like taking a step back and looking at all the things that could potentially go wring, from market shifts to supply chain disruptions or even cybersecurity threats.</em></blockquote><blockquote><em>For example, if a company heavily relies on a single supplier and there’s a chance that supplier and there’s a chance that supplier might go out of business, that’s a risk. Assessing this risk involves considering how likely it is for the supplier to fail and what consequences it would have on production and sales. By understanding these risks, business can make informed decisions about how to manage them, whether it’s by diversifying suppliers, investing in backup systems, or taking out insurance. Ultimately, risk assessment in business is about safeguarding the company’s success by being prepared for potential challenges and opportunities alike.</em></blockquote><blockquote><em>In the domain of business, risk assessment can be broken down into two main approaches: qualitative risk assessment and quantitative risk assessment.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/0*N84yn7hmPUuJSYOS.png" /></figure><blockquote><em>What is Qualitative Risk Assessment?</em></blockquote><blockquote><em>Qualitative risk assessment is like a simple way of looking at risks in a business to identify the risk that needs detail analysis and the necessary controls and actions based on the risk’s effect and impact on objectives. There two main methods used:</em></blockquote><blockquote><strong><em>1. Keep It Super Simple (KISS): </em></strong><em>This method is for smaller projects or when things need to be kept simple. You rate risks on a basic scale, like very high, high, medium, low or very low.</em></blockquote><blockquote><strong><em>2. Probability/Impact: </em></strong><em>This method is for bigger, more complicated issues. You rate risks based on how likely they are to happen (probability) and how much they could affect the business(impact). You might use a scale from 1 to 10 or 1 to 5 for this.</em></blockquote><blockquote><em>Qualitative risk assessment helps businesses quickly spot areas where things could go wrong in their everyday operations. It’s like a first step to identify potential problems. Then, if needed, they can use quantitative risk assessment, which gives more detailed information and data. Quantitative assessment is more objective, but it’s still just an estimate. It’s used when businesses need to make really important decisions or tackle complex tasks. However, sometimes just doing a qualitative assessment is enough, and you don&#39;t need to do the more detailed quantitative assessment for every risk.</em></blockquote><blockquote><em>What is Quantitative Risk Assessment?</em></blockquote><blockquote><em>Quantitative risk assessment is a deeper dive into the most important risks a business faces. Instead of just rating risks on a scale, like in qualitative analysis assigns numerical values to risks. This helps to understand the likelihood and impact of each risk more precisely. The goal is to turn the uncertainties into measurable quantities, making it easier to make decisions.</em></blockquote><blockquote><em>For example, instead of just saying a risk is high, you might say there’s a 70% chance of it happening and it could cost $100,000 if it does. This kind of detailed analysis is especially useful for big, complex projects or issues where there’s a lot at stake. It helps businesses set realistic goals for costs, schedules, and scopes, and gives upper management a clearer picture of what to expect.</em></blockquote><blockquote><em>What’s the difference between these two approaches?</em></blockquote><blockquote><em>The fundamental contrast between qualitative and quantitative risk analysis lies in how risks are evaluated. Qualitative analysis relies on subjective judgments or perceptions, whereas quantitative analysis is grounded in factual and specific data. Additionally, the representation of risk differs between the two approaches. In qualitative analysis, risks are typically rated or scored, often denoted as “Low” or assigned numerical values likes 1, indicating the level of urgency for attention. Conversely, quantitative analysis assigns values in terms of percentages, reflecting the likelihood of a risk occurring or its potential impact on project objectives.</em></blockquote><p>As we wrap up our chat about qualitative and quantitative risk assessment, remember this: it’s all about finding your sweet spot. Whether you’re trusting your gut or crunching numbers, there’s no wrong way to manage risks — it’s about what works best for you and your team.</p><p>So, as you navigate the wild world of risk, keep experimenting, keep learning, and keep adapting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*7t6OzRBjQGnoKQEbcIw0iQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f17f893e4c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Basic Guide to Data Security]]></title>
            <link>https://lahstaa.medium.com/a-basic-guide-to-data-security-83b4a0110d82?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/83b4a0110d82</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 12 Mar 2024 08:00:18 GMT</pubDate>
            <atom:updated>2024-03-12T08:00:18.979Z</atom:updated>
            <content:encoded><![CDATA[<p>Join me on my blog journey where we’re making sense of the digital world. First, let’s tackle “Data Handling” — just sorting out your digital stuff 101. Then, we’re getting with “Data Handling Practices” — easy tips to keep things smooth. Next up, we’re exploring “Understanding Logging and Monitoring” — keeping an eye on your digital turf. Finally, we’ll dive into “Digital Locks: Keeping Your Info Safe with Encryption” — the how-to for securing your digital secrets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*sh7sR5pf0t7kV3a8iws7bg.gif" /></figure><h3>Data Handling</h3><blockquote><em>Think of data like a living thing — people create it, use it, share it, and change it. There are different ways to describe this process, but they all have similar steps. One useful way to look at it is the data security life cycle model. It fits well with the different jobs people and organizations do as data goes from being made to getting rid of it.</em></blockquote><blockquote><em>Consider the life of information as a journey unfolding in six main stages. It all begins with creation, where knowledge is born, often quietly understood. The story progresses to storage, where information is documented, transforming into a clear narrative. Usage comes next, a chapter where information might evolve, expand, or lose parts of its essence. Then there’s sharing, a stage where data is passed on to others, whether by copying or relocating. Occasionally, there’s destruction, the concluding chapter for data that has served its purpose and is ready to fade from the narrative.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/0*QJtjglo2MZMApWDv.png" /><figcaption>Data Lifecycle Management</figcaption></figure><p><strong>Data Handling Practices</strong><br><br>Just like you take care of your favorite stuff, data is important and needs to be handled carefully. Some data, like passwords, needs extra protection, while other things, like your list of favorite movies, can be shared easily. Think of organizing data like sorting things into folders — some are private (like passwords), and some are for sharing (like your movie list).</p><p>Data also has a life story — it’s made, used, and sometimes it’s not needed anymore. Some data stays for a long time, but other things are deleted when we don’t need them. Now, let’s talk about four important ways we handle data: Classification, Labeling, Retention, and Destruction.</p><blockquote><strong><em>Classification:</em></strong><em> Businesses know that information is valuable, and it it’s not kept secret, others might use it to their advantage. So, they sort information into categories, deciding how it can be used or shared. This is called classification. Before putting labels on information, they check how much harm it could cause it it’s not kept safe. This is the first step, and it’s called classification. It looks at how important it is to keep the information confidential, intact, and available.</em></blockquote><blockquote><em>These classifications follow rules from laws, contracts, or business standards. For example, one category might mean “minor impact,” and another could be “serious, might even harm people.” It depends on how the business decides to handle risks. The goof thing about classification is that it helps set up better security. If all similarly classified information gets the same protection, it makes things more efficient and secure.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*XE04TvcZyLJ59n5bCno1tw.png" /></figure><blockquote><strong><em>Labeling: </em></strong><em>Security labels are like protective shields for classified information. The idea is to have a simple way of showing how sensitive or important data is. The higher the level, the more harm it could cause to the organization if it’s not kept safe. So, higher sensitivity levels get more security protection.<br>Organizations can create their own systems to classify data based on their needs. It’s good to have enough categories to show the differences in sensitivity but not so many that it confuses people. Usually, two or three categories work well, and more than four can be tough to manage.</em></blockquote><blockquote><em>Here are some examples of sensitivity levels and their labels:</em></blockquote><blockquote><strong><em>Highly restricted:</em></strong><em> If this data is compromised, it could seriously threaten the organization’s existence. It might even lead to significant harm, like loss of life or property damage.</em></blockquote><blockquote><strong><em>Moderately restricted: </em></strong><em>If this data is compromised, it could result in losing a temporary competitive advantage, revenue, or disrupt planned investments or activities.</em></blockquote><blockquote><strong><em>Low sensitivity (or “internal use only”): </em></strong><em>If this data is compromised, it might cause minor disruptions, delays or impacts.</em></blockquote><blockquote><strong><em>Unrestricted public data: </em></strong><em>Since this data is already public, there’s no harm in sharing it further.</em></blockquote><blockquote><strong><em>Retention: </em></strong><em>Keeping information and data for just the right amount of time is crucial, not too long,not too short. Laws and industry standards often dictate how long certain types of data should be retained. When these rules aren’t in place, organizations must create their own data retention policies for both physical and electronic data. It’s a responsibility to ensure data destruction when it reaches its limit, and security professionals play a vital role. They need to keep an accurate inventory, noting where the data is, its retention period, and how it should be destroyed.</em></blockquote><blockquote><em>Records retention policies set the guidelines for how long organizations should keep information and assets. These policies should ensure that personnel understand retention requirements, proper documentation is in place, and data is retained according to the schedule, not beyond. A common mistake is applying the longest retention period to all types of information, leading to wasted storage space, increased data exposure risk, and difficulties in finding relevant information. Regular reviews are necessary to reduce unnecessary data and preserve only what’s essential.</em></blockquote><blockquote><em>Avoiding mistakes is crucial, as improperly kept data may violate external requirements, resulting in fines or legal issues. When information is no longer mandated to be retained, it should be promptly and properly destroyed following enterprise policies and any relevant legal requirements.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*YM4oAM8PzNQwwFuYehXMHA.png" /></figure><blockquote><strong><em>Destruction: </em></strong><em>When data is deleted, there’s a risk it might still be lingering on the device, know as remanence, posing a security threat. To minimize this risk:</em></blockquote><blockquote><strong><em>Clearing the device or system: </em></strong><em>This involves overwriting or zeroizing, writing various random patterns throughout all storage media. However, there’s a risk of missed blocks containing sensitive information.</em></blockquote><blockquote><strong><em>Purging the device or system: </em></strong><em>This method reduces the chance of recovering residual physical effects from the original data. Some technologies, like certain magnetic disks, may still retain data “ghosts” even after overwriting. Purging is a more thorough process.</em></blockquote><blockquote><strong><em>Physical destruction:</em></strong><em> This is the ultimate solution. Devices like magnetic or optical disks may need to be mechanically shredded, burned, or otherwise destroyed. Their remnants might be disposed of in protected landfills.</em></blockquote><blockquote><em>In routine situations, clearing a system may be sufficient. However, when elements are replaced or disposed of, as in maintenance or upgrades, purging or destruction becomes crucial to prevent sensitive information from being compromised by potential attackers.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9xQQVfEUWrlwyc6pCPWFjw.jpeg" /></figure><h3><strong>Understanding Logging and Monitoring</strong></h3><blockquote><em>Logging in computer systems is crucial for capturing signals from events, enabling accountability and security. Major controls frameworks stress organizational logging practices, recording user IDs, system activities, and more. Log reviews are essential for security assessment, incident identification, and audits. A well-designed log management infrastructure is vital to preserve data integrity, protect against unauthorized changes, and adhere to retention policies. Logging plays a pivotal role in maintaining system health, detecting compromises, and supporting forensic analyses.</em></blockquote><blockquote><em>Tools employed for monitoring and mitigating risks from attacks depend on the direction of the threat, whether it originates from inbound or outbound traffic in the infrastructure. Ingress monitoring involves the surveillance and assessment of all inbound communications traffic and access attempts. Devices and tools that provide logging and alerting capabilities for ingress monitoring include firewalls, gateways, remote authentication servers, IDS/IPS tools, SIEM solutions, and anti-malware solutions.</em></blockquote><blockquote><em>Conversely, egress monitoring focuses on regulating data leaving the organization’s IT environment, often associated with data loss prevention (DLP) or data leak protection. DLP solutions should be strategically deployed to inspect various forms of outbound data, covering aspects such as email content and attachments, copying to portable media, File Transfer Protocol (FTP), posting to web pages/websites, and interactions with applications and application programming interfaces (APIs).</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A07RzC7at0edrYvYz9CIFA.jpeg" /></figure><h3><strong><em>Digital Locks: Keeping Your Info Safe with Encryption</em></strong></h3><blockquote><em>An encryption system is like a digital security setup that consists of hardware, software, algorithms, control parameters, and methods. Its job is to provide various encryption services, keeping data safe and confidential.</em></blockquote><blockquote><em>Now, let’s talk about plaintext. Plaintext is simply the regular, unencrypted data or message. It’s in its normal form, easy to understand and use. This could include different things.</em></blockquote><blockquote><strong><em>Image, Audio, or Video Files: </em></strong><em>These can be in their raw or compressed forms, basically how they are before any encryption.</em></blockquote><blockquote><strong><em>Human-readable Text and Numeric Data: </em></strong><em>Any kind of text or numbers that people can easily understand. It might also have formatting or extra information that helps structure and describe it.</em></blockquote><blockquote><strong><em>Database Files or Records:</em></strong><em> Information stored in databases, organized into records and fields. This could be anything from customer names to product details.</em></blockquote><blockquote><strong><em>Anything Represented Digitally: </em></strong><em>This encompasses a wide range basically anything that can be processed, transmitted, or stored by computers. It might include data that isn’t readable by humans initially.</em></blockquote><blockquote><em>In our digital world, cryptography is like a secret code that keeps our information safe and secure. It’s used in many activities we do every day. When we make online transactions or download software updates, cryptography ensures that the information is protected.</em></blockquote><blockquote><em>Here’s how it works:</em></blockquote><blockquote><strong><em>Cryptography</em></strong><em> uses a process called encryption to transform regular information (called plaintext) into a secret code (called ciphertext). This secret code is like a lock that only the intended recipient can open. So, even if someone else tries to see or understand the information, they can’t because it’s in this encrypted form.</em></blockquote><blockquote><strong><em>Cryptography</em></strong><em> provides different services to help keep our systems secure:</em></blockquote><blockquote><strong><em>Confidentiality: </em></strong><em>This means keeping information a secret. Cryptography hides messages so that only the person it’s meant for can understand them. It’s like having a private conversation that others can’t eavesdrop on.</em></blockquote><blockquote><strong><em>Integrity:</em></strong><em> This ensures that the information hasn’t been changed by mistake or on purpose. Cryptography uses tools like hash functions and digital signatures to verify that a message is the same as when it was sent. If anything is altered, its like a red flag, and the recipient will notice that something’s not right.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2TCt7GcbZLlKNJrklo8Uog.png" /></figure><p>And there you have it, folks! That’s a wrap on our digital chat today. I hope you found some helpful nuggets for dealing with your digital stuff and keeping it all secure. Remember, you’re the captain of your online ship! Keep things locked up and stay tuned for more tips. Until next time, take it easy and keep those online vibes safe!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*Y_4AabexE3wYAgtzy9Srzw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83b4a0110d82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL INJECTION UNION ATTACK]]></title>
            <link>https://lahstaa.medium.com/sql-injection-union-attack-8a91e7dbbf15?source=rss-7361b7dae14d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a91e7dbbf15</guid>
            <dc:creator><![CDATA[Lahsta]]></dc:creator>
            <pubDate>Tue, 05 Mar 2024 05:22:40 GMT</pubDate>
            <atom:updated>2024-03-05T17:51:18.355Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog will provide an exploration of SQL injection, with a specific focus on the SQL Injection UNION attack. The content will revolve around practical demonstrations utilizing the laboratory exercises available on <a href="https://portswigger.net/web-security/all-labs">https://portswigger.net/web-security/all-labs</a>.</p><blockquote><em>SQL Injection, commonly referred to as SQLi, represents a web security vulnerability enabling attackers to disrupt an application’s database queries. Exploiting this vulnerability grants unauthorized access to view data beyond their intended scope. Furthermore, malicious actors can manipulate or delete this data, resulting in enduring alterations to the application’s content or functionality.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*xaK1PKZd-oemL9UEcuh1LQ.png" /><figcaption>SQL Injection Attack</figcaption></figure><blockquote><em>SQLi vulnerability encompasses a variety of attacks and techniques, each applicable in distinct situations. Several common examples of SQLi include:</em></blockquote><blockquote><strong><em>1. Retrieving Hidden Data:</em></strong><em> This involves modifying a SQL query to extract additional results that are not typically visible.</em></blockquote><blockquote><strong><em>2. Subverting Application Logic:</em></strong><em> Attackers manipulate a query to disrupt the normal flow of an application’s logic.</em></blockquote><blockquote><strong><em>3. UNION Attacks:</em></strong><em> Exploiting the UNION SQL operator to combine and retrieve data from different tables in the database.</em></blockquote><blockquote><strong><em>4. Blind SQLi:</em></strong><em> The results of a query, controlled by the attacker, are not directly disclosed in the application’s responses.</em></blockquote><p>Let’s now delve into the specifics of SQL Injection UNION attacks:</p><blockquote><em>In the event of a SQL injection vulnerability in an application, where query results are incorporated into the application’s responses, exploiting the UNION keyword enables the extraction of data from different tables within the database. This exploit is commonly identified as a SQL injection UNION attack.</em></blockquote><blockquote><strong><em>Learning Path:</em></strong></blockquote><blockquote><strong><em>Web Security Academy &gt; SQL injection &gt; UNION attacks &gt; Lab</em></strong></blockquote><p><a href="https://portswigger.net/web-security/sql-injection/union-attacks/lab-retrieve-data-from-other-tables">Lab: SQL injection UNION attack, retrieving data from other tables | Web Security Academy</a></p><blockquote><strong><em>Lab Description:</em></strong><em><br> This lab contains a SQL injection vulnerability in the product category filter. The results from the query are returned in the application’s response, so you can use a UNION attack to retrieve data from other tables. To construct such an attack, you need to combine some of the techniques you learned in previous labs.The database contains a different table called </em><em>users, with columns called </em><em>username and </em><em>password.To solve the lab, perform a SQL injection UNION attack that retrieves all usernames and passwords, and use the information to log in as the </em><em>administrator user.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*GsascFLbyVNrlIPVZsYpkg.png" /></figure><h3><strong>STEPS:</strong></h3><blockquote><strong><em>Step 1: </em></strong><em><br>Upon initially entering the lab, one will notice the presence of a web store featuring multiple categories. Additionally, the refine your search functionality allows users to narrow down the inquiries and explore specific product categories.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ktXfnxcoDrNWWKVojjayJw.png" /></figure><blockquote><strong><em>Step 2:</em></strong></blockquote><blockquote><em>When refining the search to a specific category, such as Accessories, an observation in the URL bar reveals a parameter labeled “category=Accessories.” This parameter corresponds to the underlying SQL query, resembling something like SELECT * FROM products WHERE category ‘Accessories’ AND released = 1.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S3O9uMbWmypEUiY48sOoNA.png" /></figure><blockquote><strong><em>Step 3:</em></strong></blockquote><blockquote><em>Attempting to change the parameter to Accessories’ category in the URL bar leads to an internal error. This issue arises because the interpretation becomes something like SELECT * FROM products WHERE category </em><strong><em>‘Accessories’’</em></strong><em> AND released = 1, causing a syntax error in the SQL query.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Zr6sf1_A3LvgL7V0ZHUXw.png" /></figure><blockquote><strong><em>Step 4:</em></strong></blockquote><blockquote><em>Now, let’s explore the UNION aspect by utilizing the null string to determine the number of columns present. To achieve this, we will append “Accessories’+union+select+null,null” to the URL. This input will be interpreted as follows: SELECT * FROM products WHERE category = ‘Accessories’ UNION SELECT null,null.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ft1hA-SE1rm-VrA4ebXgCQ.png" /></figure><blockquote><strong><em>Step 5:<br></em></strong><em>Having received a successful response, we can infer the presence of two columns. To discern the data type within a column, a test query “Accessories’+union+select+’test’,’test1&#39; “ is employed. Confirming a successful response indicates that the column indeed contains string values.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gNNAHqh6xEmcZ_XBbNGY0g.png" /></figure><blockquote><strong><em>Step 6:</em></strong></blockquote><blockquote><em>Attempting to infiltrate the login credentials by injecting “Accessories’+union+select+username,password+from+users — ” into the URL results in an interpretation such as SELECT * FROM products WHERE category = ‘Accessories’ UNION SELECT username,password FROM users — ‘. This query successfully retrieves login credentials for users, including the administrator.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnsR1xRHZkpu_quNkjX3hg.png" /></figure><blockquote><strong><em>Step 7:</em></strong></blockquote><blockquote><em>With the discovered credentials of the administrator, we can proceed to log in to the web page, thereby successfully completing the lab.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8cdjofUg3AMr4SSYUXuLog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8c2_MxKGdAnd6mzQjRrXkA.png" /></figure><p>In a nutshell, we dived into SQL Injection stuff, focusing on the UNION attack. It’s like a sneaky way bad guys mess with a website’s database. We did a hands-on example to show how they can grab data and even snag admin logins. The takeaway? Keep your web defenses strong, write secure code, and regularly check for any shady business in your apps. Stay safe out there!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a91e7dbbf15" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>