<?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 Karthik S on Medium]]></title>
        <description><![CDATA[Stories by Karthik S on Medium]]></description>
        <link>https://medium.com/@karthiksuresh2116?source=rss-4b3f70e2260a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*w4CKti2gug3EnLQZfVTSUA.jpeg</url>
            <title>Stories by Karthik S on Medium</title>
            <link>https://medium.com/@karthiksuresh2116?source=rss-4b3f70e2260a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 16:18:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karthiksuresh2116/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[Threat Modeling: Zero to Hero]]></title>
            <link>https://medium.com/@karthiksuresh2116/threat-modeling-zero-to-hero-a547e32dcb1a?source=rss-4b3f70e2260a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a547e32dcb1a</guid>
            <category><![CDATA[mitigating-risks]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[pasta]]></category>
            <category><![CDATA[threat-modeling]]></category>
            <category><![CDATA[stride]]></category>
            <dc:creator><![CDATA[Karthik S]]></dc:creator>
            <pubDate>Sun, 04 May 2025 15:46:35 GMT</pubDate>
            <atom:updated>2025-05-04T15:46:35.086Z</atom:updated>
            <content:encoded><![CDATA[<p>You may be familiar with the “shift left” practice in SDLC. In cybersecurity, shift left means moving security or critical processes earlier in the design or development phase rather than the testing and deployment phase. Shift right is just the opposite of shift left. Threat Modeling is one of the practices that came under the shift left.</p><p>Threat Modeling is the process of systematically identifying and evaluating vulnerabilities, potential threats and attack vectors before they become real world problems.</p><p>In the case of Threat Modeling, we need to consider four main points:</p><p><strong>1. Identify What You Are Building</strong></p><p>Once Albert Eintein said “If I had an hour to solve a problem, I’d spend 55 minutes thinking about the problem and 5 minutes thinking about solutions”. If you are threat modeling a bank application, then you need to understand all the capabilities, functions, features and limitations properly. You can use data flow diagram, Architecture Diagram, ERD, Code review or even a threat focused discussion with the developer.</p><p>Identify the trust boundary. Also called as Transition boundary</p><p>1.1 What are Transition Boundaries?<br> <br> These are points where data moves:</p><p>Between different trust levels (e.g., user → application server)</p><p>Between different components (e.g., frontend → backend)</p><p>Across network zones (e.g., public internet → internal network)<br> <br>Security Control Points (SCPs) : Places in the architecture where security controls can be enforced (e.g., authentication gates, API gateways).</p><p><strong>2. What Can Go Wrong</strong></p><p>Basically, what threats may happen? It is an important and difficult task in threat modeling to predict the threat.</p><p>* Can data be tampered with?</p><p>* Can someone spoof an identity?</p><p>* Can the system be overloaded?</p><p>Due to its complexity, we have different models to predict the threat: STRIDE, DREAD, PASTA, VAST, LINDDUN</p><p>2.1 STRIDE — SPOOFING, TAMPERING, REPUDIATION, INFORMATION DISCLOSURE, DOS, ELEVATION OF PRIVILEGE</p><p>STRIDE model was developed by Microsoft.</p><p>Beginners may still be confused about how to apply STRIDE. Think that you have a DFD, which consists of different processes, data stores, data flows, and external entities.</p><p>DFD Element Apply STRIDE Threats</p><p>External Entity Spoofing<br>Process Tampering, Repudiation, DoS, EoP<br>Data Store Tampering, Repudiation, Info Disclosure<br>Data Flow Tampering, Info Disclosure, DoS</p><p>And the questions?</p><p>Spoofing (External Entity): Can someone fake an identity to interact with the system?</p><p>Tampering (Data Flow/Data Store): Can someone modify the data in transit or at rest?</p><p>Repudiation (Process/Data Store): Can a user deny performing an action?</p><p>Information Disclosure: Can sensitive data be exposed through flows or storage?</p><p>Denial of Service: Can this process or data flow be overwhelmed?</p><p>Elevation of Privilege (Process): Can a user gain unauthorized access to system functions?</p><p>2.2 DREAD</p><p>In case of STRIDE, it helps to identity threat but DREAD not for identifying, its for prioritising threats.</p><p>a) Damage Potential<br> b) Reproducibility<br> c) Exploitability<br> d) Affected Users<br> e) Discoverability<br> <br> Each factor is given 1(low) to 10(High) score, DREAD SCORE = (D+R+E+A+D)/5<br> <br>Let’s say you found a CSRF vulnerability:</p><p>Factor Score</p><p>Damage Potential 6<br>Reproducibility 9<br>Exploitability 8<br>Affected Users 7<br>Discoverability 9<br>Average Score 7.8 → High priority</p><p>2.3 PASTA : Process for Attack Stimulation and Threat Analysis</p><p>It aligns technical threats with business objectives. Simply stimulate attacks to ensure threat and vulnerabilities.</p><p>PASTA have 7 stage process:</p><p>1. Define Objectives — Identify business and system<br> 2. Define Scope — Identify the technical scope<br> 3. Decomposition — Decompose application in to parts with DFD, Architecture.<br> 4. Threat Analysis<br> 5. Vulnerability or Risk Assesment<br> 6. Stimulate Attacks<br> 7. Risk &amp; Impact Analysis — Map threat to business impact<br> <br>2.4 VAST</p><p>Visual, Agile and Simple Threat Modeling</p><p>It can be classified in to two:<br> <br> 1. Application Threat Modeling : You model threats in individual applications — data flow, authentication, input validation, etc.<br> 2. Operations Threat Modeling : You model threats related to deployment, infrastructure, network, configurations, and interconnected services.<br> <br>Visual : It makes system visual clear, by using DFD instead of complex diagrams</p><p>Agile : It is synced with each sprint. As in Agile model changes are happened according to spring feedback. Similarly threat modeling can be also done.</p><p>Simple : Uses tools like ThreatModeler. and can be done by developers, not only by security experts.</p><p>2.5 LINDDUN</p><p>Similar to STRIDE, but STRIDE focus on security threats, LINDDUN focus on privacy threats.</p><p>1. LINKABILITY : Ability to link to pieces of data about the same user.<br> 2. IDENTIFIABILITY : Ability to identify an user from anonymous data.<br> 3. NON-REPUDIATION : User cannot deny actions within privacy policies.<br> 4. DETECTABILITY : Ability to detect whether someone performed an action.<br> 5. INFORMATION DISCLOSURE<br> 6. UNAWARENESS : Users are unaware of how their data is collected and treated.<br> 7. NON-COMPLIANCE : Not meeting legal or regulatory standards like GDPR (General Data Protection Regulation)<br> <br> Each of these are done in each componenents to ensure privacy.<br> <br>2.6 ATTACK TREE</p><p>An Attack Tree is a visual and structured way to represent how an attacker might compromise a system. It breaks down a high-level threat (the root) into smaller, more detailed attack steps (the branches and leaves).</p><p><strong>3. What are we doing to mitigate the threats?</strong></p><p>The third main point regarding threat modeling is simply how we mitigate the threats.</p><p>Mainly foucus on :</p><p>Selecting appropriate security controls (e.g., input validation, authentication, encryption).</p><p>Applying design changes to reduce attack surface.</p><p>Introducing mitigations for each identified threat based on risk.</p><p>Frameworks to mitigation:</p><p>3.1 Security Control Frameworks<br> <br> NIST SP 800–53: A detailed catalog of security and privacy controls.<br> <br> ISO/IEC 27001: Offers a comprehensive set of practices to manage information security risks.</p><p>3.2 OWASP ASVS (Application Security Verification Standard)<br> <br> 3.3 Microsoft SDL (Security Development Lifecycle)<br> <br> 3.4 MITRE ATT&amp;CK (for mapping to real-world attack techniques)</p><p>Add ons:</p><p>How to mitigate Spoofing?</p><p>Spoofing is when an attacker pretends to be someone or something else to gain unauthorized access or trust. This could mean faking a user identity, IP address, email, or even a system component to trick others into accepting them as legitimate.</p><p>a) Strong Authentication : Multi-factor Authentication, Password Policies, Common Password detection,..etc<br> b) Session Management : Secure session token, Regenarate session ID, CSRF Token,..etc<br> c) Secure Transmission : Use HTTPS/TLS for transmission.<br> d) Account Lockout &amp; Monitoring : Lock account on brute force (multiple failed login attempts)<br> e) Avoid Insecure Authentication : Do not use spoofable things for identity (like User-agent, IP)<br> d) Use Digital Signature<br> <br>Tampering :</p><p>Tampering is the act of intentionally altering data or code — either in transit, at rest, or during execution — to cause unintended behavior, exploit systems, or gain unauthorized access.</p><p>a) Spoofing mitigations are applicable.<br> b) Access control : Restrict who can access and modify data.<br> c) Integrity check and Input Validation.</p><p>Repudiation :</p><p>Repudiation is when a user denies performing an action without a way for the system to prove otherwise. It’s about lack of accountability — the system fails to track actions or attribute them to specific users.</p><p>a) Logging : Maintain detailed, tamper-proof logs of user actions.<br> b) Authentication : Tie actions to verified user identities.<br> c) Non-repudiation Mechanisms : Use digital signatures to prove origin and integrity of actions.<br> d) Audit Trails — Ensure all sensitive operations are logged and monitored.<br> <br>Information Disclosure :</p><p>Information Disclosure refers to the unintentional exposure of sensitive data to unauthorized users. It involves leaking internal system details, personal data, or confidential business information.</p><p>a) Surpress error details<br> b) Classify data with its importance and sensitivity<br> c) Use Encryption</p><p>Denial of Services :</p><p>Denial of Service refers to attacks aimed at making a service unavailable to legitimate users by overwhelming it with traffic or resource-heavy requests, crashing the system, or exhausting its resources.</p><p>a) Rate limiting<br> b) Input validation<br> c) Resource Handling setup<br> d) Autoscaling and Redundancy<br> e) Use WAF and CDN<br> <br>Elevation of privilage:</p><p>Elevation of Privilege (EoP) occurs when an attacker gains higher access rights than intended — such as a normal user gaining admin-level control — allowing them to perform unauthorized actions.</p><p>a) Role based access control : Each user have defined acccess.<br> b) Server side autherization : Never trust client for privilege checks.<br> c) Update and patch application regularly.<br> d) Follow principle of least privilege : Least privilege to user and process which it needs.<br> <br> <br> <br><strong>4. What have we done is enough?</strong></p><p>This step ensures that the controls and mitigations you’ve designed and implemented actually reduce or eliminate the identified threats. It’s about verifying that your security posture is effective in the real world.</p><p>4.1 Security Testing<br> Penetration Testing: Simulate real-world attacks to validate controls.</p><p>Vulnerability Scanning: Automated tools to find known issues.</p><p>Fuzz Testing: Send random or malformed inputs to identify system weaknesses.</p><p>4.2 Code Reviews<br> Manual or automated source code analysis to confirm security controls are properly implemented.</p><p>4.3 Red Team Exercises<br> Involve adversarial simulation to test the detection and response capabilities.</p><p>4.4 Security Audits<br> Internal or third-party audits based on security frameworks (e.g., ISO 27001, NIST).</p><p>4.5 Security Metrics<br> Measure how effective controls are using KPIs:</p><p>Number of threats mitigated</p><p>Time to detect/respond</p><p>Number of false positives/negatives</p><p>4.6 Threat Reassessment<br> <br> Go back to STRIDE/DREAD/PASTA and re-evaluate threats based on new understanding or evolving tech (e.g., AI models, cloud shifts).<br> <br> <br><strong><em>Threat modeling isn’t just a checkbox — it’s a strategic mindset that helps teams proactively identify and mitigate security risks before they turn into real-world attacks. From understanding STRIDE and PASTA to applying models like VAST and LINDDUN, you’ve now seen how each approach fits into different phases of software development. Whether you’re protecting a banking application or a small microservice, integrating threat modeling into your SDLC ensures security is built-in, not bolted on. As you grow from zero to hero in this journey, remember: the best defense starts with thinking like an attacker — before they do.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a547e32dcb1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File Upload Vulnerabilities: Conventional Threats and Emerging Risks in 2025]]></title>
            <link>https://medium.com/@karthiksuresh2116/file-upload-vulnerabilities-conventional-threats-and-emerging-risks-in-2025-cf27eee4fb03?source=rss-4b3f70e2260a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf27eee4fb03</guid>
            <category><![CDATA[filé]]></category>
            <category><![CDATA[new-vulnerabilities]]></category>
            <category><![CDATA[file-upload-vulnerability]]></category>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[bypass-technique]]></category>
            <dc:creator><![CDATA[Karthik S]]></dc:creator>
            <pubDate>Fri, 02 May 2025 07:43:05 GMT</pubDate>
            <atom:updated>2025-05-02T10:10:59.092Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is File Upload Vulnerability?</strong></p><p>When a web server allows users to upload files to its file system without sufficiently validating things like their name, type, content, and size.</p><p><strong>Common Attacks:</strong></p><p><strong>Uploading Malicious Files</strong>: Attackers can upload files like PHP, ASP, or other executable scripts disguised as image files (e.g., .jpg, .png, .gif). If the server doesn’t properly restrict file types or validate them correctly, the attacker can execute malicious code after the file is uploaded. Or by manipulating request after browser using Burp like tools.</p><p><strong>Multiple Extension:</strong> A multiple extension attack in file upload vulnerabilities involves uploading a file with a double extension (e.g., file.php.jpg) to bypass security checks, tricking the server into executing malicious code disguised as a safe file type.</p><p><strong>Bypassing Blacklisted Extension</strong>: Blacklists struggle to block malicious files (e.g., script.php.jpg bypassing as an image) without restricting legitimate files (e.g., valid .jpg uploads), as attackers use tricks like double extensions or rare file types (ps2, sct, cpl).</p><p><strong>Fuzzing &amp; Black Box Techniques</strong>: Fuzzing &amp; black box testing involves sending random or malformed inputs (e.g., unexpected file extensions like .php%00.jpg) to a system to uncover vulnerabilities, without knowledge of its internal code, mimicking real-world attacks.</p><p><strong>Path Traversal Risks</strong>: File uploads allow attackers to access or overwrite sensitive files (e.g., ../../etc/passwd) by manipulating file paths, bypassing directory restrictions and potentially compromising the server.</p><p><strong>Bypassing MIME Checks</strong>: Bypassing MIME type checks involves uploading a malicious file (e.g., a script disguised as image/jpeg by altering headers) to trick the server into accepting it, exploiting weak validation that trusts client-provided MIME types.</p><p><strong>Upload Using Put Method</strong>: File upload using the PUT method allows attackers to directly upload malicious files (e.g., malware.php) to a server if improperly configured, bypassing typical upload forms by exploiting HTTP PUT permissions.</p><p><strong>SVG file upload</strong>: SVG file uploads can be exploited to execute malicious JavaScript (e.g., &lt;script&gt;alert(‘XSS’)&lt;/script&gt; embedded in the SVG), bypassing image validation due to SVG’s XML-based structure, leading to XSS or other attacks.</p><p><strong><em>“If server-side file sanitization is in place, only SVG file upload attacks may work, as sanitization often misses embedded JavaScript in SVG files.”</em></strong></p><p><strong>Attacks in 2025</strong>:</p><p><strong>a) Magic Number Shifting</strong>: A magic number is a unique sequence of bytes (or pattern) located at the beginning of a file that identifies its type. For example:</p><p>JPEG files start with FF D8 FF</p><p>PNG files start with 89 50 4E 47</p><p>WebP files start with 52 49 46 46 00 00 00 57 45 42 50</p><p>File-upload security mechanisms often check these magic numbers to verify the file type before allowing uploads.</p><p><strong>Attack Scenario</strong> :</p><p>In a shifting magic number attack, an attacker may alter or move the magic number in such a way that it’s no longer in its original place but still part of the file, effectively bypassing checks.</p><p>1. The attacker uploads a file that appears to be a harmless image (e.g., a JPEG or PNG).</p><p>2. The magic number of the image is shifted, for example, moving the FF D8 FF (JPEG signature) to somewhere in the middle of the file.</p><p>3. The file is still technically a JPEG image, but the header is malformed or doesn’t match what the server expects.</p><p>4. The server may allow the file upload based on the initial checks (e.g., validating file extensions or basic magic number).</p><p>5. The attacker executes their payload (such as arbitrary code execution or XSS) hidden inside the rest of the file, bypassing the magic number check.</p><p><strong>b) Vulnerable ICO Files</strong>: ICO files are commonly used for icons in Windows, so many websites allow them to be uploaded. But on a Windows server, these files can be risky. If the server processes or resizes the uploaded ICO file using tools like GDI+, Windows Shell, or ImageMagick, it could crash or even allow hackers to run malicious code — especially on older servers that aren’t updated.</p><p><strong>c) WebP Files</strong>: WebP is a modern image format developed by Google. But in 2023, a critical vulnerability (nicknamed “WebPocalypse”) was found that affected almost every browser and app using libwebp. A malformed WebP image could lead to heap buffer overflows, enabling attackers to run malicious code on the target machine.<br>CVE-2023–4863 impacted Chrome, Firefox, Electron apps, and more.</p><p>For example, CVE-2017–0235 was a vulnerability in Windows GDI+ where a specially crafted ICO file could lead to remote code execution.</p><p>CVE related to File Upload Vulnerabilities in 2025 :</p><p>* CVE-2025–31324 — SAP NetWeaver Visual Composer<br>* CVE-2025–22654 — Kodeshpa Simplified<br>* CVE-2025–1165 — Lumsoft ERP 8</p><p><strong>Mitigations</strong>:</p><p>Strict File Type Validation: Only allow specific, trusted file formats (e.g., images) and check the file’s content to ensure it matches the expected type.</p><p>Sanitize Metadata: Remove any embedded metadata from uploaded files (like EXIF, IPTC, or XMP) to prevent leakage of sensitive information.</p><p>Limit Execution Permissions: Ensure uploaded files cannot be executed by restricting file permissions and avoiding the execution of files in directories accessible via the web.</p><p>Use Content Security Policies: Implement strict content security policies (CSP) to prevent scripts from running within uploaded files, such as SVG or image files with embedded JavaScript.</p><p>Regularly Update Security Tools: Keep your image processing and file upload libraries up to date to mitigate any vulnerabilities, especially those related to buffer overflow or remote code execution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf27eee4fb03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How CSRF Works: A Deep Dive into Web Application Security]]></title>
            <link>https://medium.com/@karthiksuresh2116/how-csrf-works-a-deep-dive-into-web-application-security-a9fb96f104e9?source=rss-4b3f70e2260a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9fb96f104e9</guid>
            <category><![CDATA[mitm-attacks]]></category>
            <category><![CDATA[session-hijacking]]></category>
            <category><![CDATA[csrf-attack]]></category>
            <category><![CDATA[csrf-token]]></category>
            <category><![CDATA[csrf-bypass]]></category>
            <dc:creator><![CDATA[Karthik S]]></dc:creator>
            <pubDate>Thu, 01 May 2025 15:06:55 GMT</pubDate>
            <atom:updated>2025-05-01T15:07:51.557Z</atom:updated>
            <content:encoded><![CDATA[<p>How CSRF Works: A Deep Dive into Web Application Security</p><p><strong>What is CSRF Token?</strong><br>Cross Site Request Forgery Token is a token that is used to authorize a client request.</p><p><strong>How does it authorize the request?</strong></p><p>Every form rendered by the server should include a hidden field named csrf_token. Upon form submission, the server compares the CSRF token submitted with the form to the token stored in the user&#39;s session.</p><p><strong>What session? Aren’t we using a token-based authentication mechanism?</strong></p><p>In token-based authentication, CSRF tokens are generally not required. CSRF tokens are typically used in session-based authentication. Using a CSRF token in session-based authentication does not mean the application is using token-based authentication.</p><p><strong>What is the difference between session-based and token-based?</strong></p><p>In session-based authentication, the user’s session information is stored on the server, and each client request includes a session ID — usually in a cookie — to identify the session. In token-based authentication, the user’s identity and authorization details are encoded into an access token (such as a JWT), which is stored on the client side, typically in local storage or session storage. This token is then included in each request, usually in the Authorization header, to authenticate and authorize the user without needing server-side session storage.</p><p><strong>Why is CSRF not generally added in token-based?</strong></p><pre>&lt;!-- Attacker&#39;s site: attacker.com --&gt;<br>&lt;form action=&quot;https://bank.com/transfer&quot; method=&quot;POST&quot;&gt;<br>  &lt;input type=&quot;hidden&quot; name=&quot;amount&quot; value=&quot;5000&quot;&gt;<br>  &lt;input type=&quot;hidden&quot; name=&quot;to_account&quot; value=&quot;attacker_account_123&quot;&gt;<br>  &lt;input type=&quot;submit&quot; value=&quot;Click Me!&quot;&gt;<br>&lt;/form&gt;<br>&lt;script&gt;<br>  document.forms[0].submit(); // Auto-submits form silently<br>&lt;/script&gt;</pre><p>This form, when auto-submitted, will trigger a POST request to bank.com, and if the user is authenticated via session cookie, it may execute the transaction unless CSRF protection is in place.<br>A CSRF attack occurs when an unauthorized request is made from a user’s browser without their consent. In token-based authentication, such attacks are ineffective because the attacker cannot access the token stored in the client’s local storage or session storage. Even if an attacker crafts a malicious form on attacker.com, the browser will not include the access token (e.g., a JWT) in the request to bank.com, since attacker.com cannot read or attach the token due to the same-origin policy. However, in session-based authentication, the browser automatically includes the session cookie with every request to bank.com, regardless of where the request originated. This makes session-based systems more susceptible to CSRF if not properly protected.</p><p>So, cross-site requests are prevented by validating the csrf_token in the request. But what if an attacker captures the response from the server, extracts the CSRF token, and crafts a form using that token? Then, by tricking the user into submitting that form (e.g., clicking a link), can the attacker bypass CSRF protection?</p><p>Yes, if the attacker can capture a valid CSRF token and force the user to submit the form before the token expires, it can potentially bypass CSRF protection. However, in real-world scenarios, this is extremely difficult due to HTTPS, SameSite cookies, short token lifetimes, and secure headers that prevent token leakage.</p><p><strong>CSRF tokens do not prevent Man-in-the-Middle (MitM) attacks; they are specifically designed to protect against Cross-Site Request Forgery (CSRF). MitM attacks require different defenses such as HTTPS, certificate pinning, and secure transport mechanisms, whereas CSRF tokens help ensure that requests originate from legitimate, user-initiated actions.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9fb96f104e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>