<?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 Sakithiyasaki on Medium]]></title>
        <description><![CDATA[Stories by Sakithiyasaki on Medium]]></description>
        <link>https://medium.com/@sakithiyasaki?source=rss-1a686e95b4a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ZSpXFIuxUvXz7oEM</url>
            <title>Stories by Sakithiyasaki on Medium</title>
            <link>https://medium.com/@sakithiyasaki?source=rss-1a686e95b4a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:29:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sakithiyasaki/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[Second-Order SQL Injection]]></title>
            <link>https://medium.com/@sakithiyasaki/second-order-sql-injection-1b3c00f78cdf?source=rss-1a686e95b4a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b3c00f78cdf</guid>
            <category><![CDATA[sql-injection]]></category>
            <dc:creator><![CDATA[Sakithiyasaki]]></dc:creator>
            <pubDate>Thu, 07 Aug 2025 08:23:43 GMT</pubDate>
            <atom:updated>2025-08-07T08:23:43.097Z</atom:updated>
            <content:encoded><![CDATA[<p>Lately, I’ve been exploring patterns and practical scenarios that often go unnoticed during standard security assessments. One recurring theme that stood out is <strong>Second-Order SQL Injection (SO-SQLi) → </strong>a vulnerability that’s <strong>stored silently and triggered later</strong>, making it harder to detect.</p><p><strong>What is Second-Order SQL Injection?</strong></p><p><strong>Second-order SQLi</strong> occurs when malicious input is stored in the DB <br>afely at first, but later gets used in a SQL query <strong>without proper sanitization</strong>, causing a delayed SQL injection.</p><h4><strong>Flow:</strong></h4><ol><li><strong>Attacker inserts malicious input</strong> (stored Without harm).</li><li><strong>Application stores it in the DB</strong> (no issue yet).</li><li>Later, <strong>application reuses that stored value in a SQL query without escaping </strong>→ <strong>SQL injection occurs</strong>.</li></ol><h4><strong>Example Scenario:</strong></h4><ol><li><strong>User registers with the following username:<br> </strong>attacker’ —</li><li>The app stores the username in the DB correctly (escaped).</li><li><strong>Later, an admin panel runs a query like:<br> SELECT * FROM users WHERE username = ‘$username’;</strong></li><li><strong>Now $username is pulled from DB.</strong></li><li><strong>Query will look like: SELECT * FROM users WHERE username = ‘attacker’ — ‘;</strong></li><li><strong>SQL query broken, injection triggered.</strong></li></ol><blockquote><strong><em>Real-World Second-Order SQLi Attack Examples</em></strong></blockquote><blockquote><strong>1. Yahoo! (Reported in Bug Bounty)</strong></blockquote><blockquote><strong>Attack Type</strong>: Second-order SQLi in email/username update.</blockquote><blockquote>Attacker registers with:<br> innocent@example.com’); DROP TABLE users; —</blockquote><blockquote>System stores it safely.</blockquote><blockquote>Later, an internal admin panel ran:<br> SELECT * FROM users WHERE email = ‘$stored_email’;</blockquote><blockquote>No escaping → resulted in SO-SQLi → potential table drop (if permissions allowed).</blockquote><blockquote><strong>Impact</strong>: High</blockquote><blockquote><strong>2. Healthcare Web Portal — Referral Code Attack</strong></blockquote><blockquote>A security researcher exploited a second-order SQLi using <strong>referral code</strong> feature.</blockquote><blockquote>Referral code stored on registration → used later in:<br> SELECT * FROM users WHERE referral_code = ‘$code’;</blockquote><blockquote>Payload inserted:<br> REF123&#39;; UPDATE users SET is_admin=1 WHERE username=’attacker’; —</blockquote><blockquote>Admin panel parsed the code later → attack triggered.</blockquote><blockquote><strong>Impact</strong>: Privilege escalation</blockquote><h4><strong>How to Test for Second-Order SQLi</strong></h4><ol><li><strong>Identify Fields That Store Data</strong></li></ol><ul><li>Signup (username, email)</li><li>Profile updates</li><li>Referral/invite codes</li><li>Custom tags/notes</li></ul><p><strong>2. Insert Safe-Looking Payloads</strong></p><ul><li>abc’ —</li><li>1&#39;; WAITFOR DELAY ‘00:00:05’ —</li><li>xyz’); UPDATE users SET is_admin=1 WHERE username=’me’; —</li></ul><p><strong>3. Trigger Injection Later</strong></p><ul><li>Visit admin/dashboard/search pages</li><li>Export functions, report generators, or backend logic</li></ul><blockquote><strong>Vulnerable Plugin Example — CVE-2024–7857</strong></blockquote><blockquote><strong>Plugin</strong>: Media Library Folders (≤ 8.2.2)<br><strong>Issue</strong>: sort_type parameter was stored and reused in raw SQL<br><strong>Impact</strong>: Second-order SQL injection when sorting functionality was triggered later</blockquote><h4><strong>How to Remediate Second-Order SQL Injection</strong></h4><p>- Use Parameterized QueriesEven when using stored values<br>- Escape Again at UsageStored ≠ Safe → Always sanitize before reuse<br>- Validate Input FormatUse allow-lists for critical fields<br>- Test Stored Data in FlowsReplay stored inputs in different execution paths</p><h4><strong>Final Thought</strong></h4><ul><li>Security isn’t just about <strong>entry-point validation</strong>.</li><li>We must trace where and how <strong>stored data is reused</strong>.</li></ul><p>Second-order vulnerabilities remind us that the most dangerous bugs are often <strong>hidden in plain sight</strong>.</p><p>Happy Learning …. ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b3c00f78cdf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding WhatsApp’s QR Code Login Mechanism (Backend Flow)]]></title>
            <link>https://medium.com/@sakithiyasaki/understanding-whatsapps-qr-code-login-mechanism-backend-flow-04072bad6902?source=rss-1a686e95b4a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/04072bad6902</guid>
            <category><![CDATA[whatsapp-qr-code]]></category>
            <dc:creator><![CDATA[Sakithiyasaki]]></dc:creator>
            <pubDate>Thu, 07 Aug 2025 08:12:50 GMT</pubDate>
            <atom:updated>2025-08-07T08:12:50.309Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wondered how WhatsApp QR login works?</p><p>Here’s a breakdown of how the secure QR login works behind the scenes:</p><p>1. QR Code Generation<br> WhatsApp Component: Primary Device<br> Your Evidence: Not in logs, visual<br> Description: Generates a QR containing prekey bundle, identity key, device ID.</p><p>2. QR Scanned by Companion<br> WhatsApp Component: Companion App (Web/Desktop)<br> Your Evidence: AccountSwitcher, EULA.onCreate, bootstrapForReg<br> Description: Companion scans QR and sends identity + prekeys via WhatsApp servers.</p><p>3. Session Established<br> WhatsApp Component: Signal Protocol (axolotl.db, WaMsys)<br> Your Evidence: signed_prekey id=5, session state logs<br> Description: Secure session established via X3DH + Double Ratchet (Signal).</p><p>4. Authenticated Login<br> WhatsApp Component: Noise Protocol over XMPP<br> Your Evidence: AuthKeyStore, performHandshake<br> Description: Auth via Noise handshake, companion is now bound to the account.</p><p>5. Session Storage<br> WhatsApp Component: axolotl.db, wa.db<br> Your Evidence: Tables: sessions, identities, wa_contacts, wa_props<br> Description: Sessions stored for persistent E2EE across devices.</p><p>6. Companion Syncs Data<br> WhatsApp Component: MessageService &amp; Storage<br> Your Evidence: messageStore not ready, then sync begins<br> Description: Messages, contacts, and settings sync from local/cloud.</p><blockquote>Behind the Scenes:<br>axolotl.db — Manages keys, prekeys, and session states.<br>whatsapp.log — Shows session bootstrap, prekey rotation, and DB inits.<br>XMPP + Noise Protocol — Ensures secure transport and authentication.<br>fbuuid: Unique session identifier (e.g., fbuuid=u8RGcLE_LYF4XuQM6R49aTgbmdY=).</blockquote><blockquote>Summary: WhatsApp’s QR code login isn’t just a scan — it’s a robust cryptographic handshake leveraging Signal Protocol (X3DH + Double Ratchet) and Noise Protocol over XMPP to ensure secure multi-device communication.</blockquote><p>💬 Have you ever thought about the tech behind your everyday apps?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hF3ZpLsNNpwZU_-L" /><figcaption><strong>Captured key events during Whatsapp QR login flow that shows handshake, identity key exchange (Noise_XX), prekey processing, and device pairing logs</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04072bad6902" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Forensics]]></title>
            <link>https://medium.com/@sakithiyasaki/android-forensics-b94989720d65?source=rss-1a686e95b4a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b94989720d65</guid>
            <dc:creator><![CDATA[Sakithiyasaki]]></dc:creator>
            <pubDate>Wed, 19 Mar 2025 08:03:42 GMT</pubDate>
            <atom:updated>2025-03-19T08:03:42.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PuRoPttyWwRs3BEvk5owNQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZjfM7n0iKG2XtZkeKem4w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JsvAmpf7lJmRyW_KzSES0w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7j_q6Odj1f7tA2ImVv38Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-dlTABEVxt_z5TQkD5SvBQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qHcwJzBkCPISGlMh1VU8PQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQQlHGFrYX4LZem-cmm7Xw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rn4eei4Zxr0OacnhmhVivA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZW0GJL6Qm4voPOQAQ8-wg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JhP1nNVqGm1w2ihmZaUMgg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v3llTq_OR238Z8oWGu-cWA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJtcBHV6pfgKAONe9GBeGA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w9TckT6nym7JxLlegcXW2w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXx7Eq3XVQKnXlzv-fpb6A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X-sRu2IcWrcLuyuXHRTCmQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTcvnNaFmfRj9DlH85kkVg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ZmdxqwhOp2Q5-KC-49uUQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1zpE8ibEUjlmLrC91OECQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XTHm8Vb-PhKWqFEauNCUAg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWSOkOuAabbXaUOqmW3e3g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuDJHK_Cz7hfxuApH0qyAA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b94989720d65" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>