Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 4 min read

I Built an Open-Source Android Firewall Because My "Offline" Apps Were Making 4,000+ Silent Connections a Day

Install a basic calculator, a flashlight app, or an offline PDF scanner on Android. Turn off the screen. Leave your phone on the desk for 8 hours. If you work with enterprise firewalls and packet logs all day, the natur

Install a basic calculator, a flashlight app, or an offline PDF scanner on Android. Turn off the screen. Leave your phone on the desk for 8 hours.

If you work with enterprise firewalls and packet logs all day, the natural question is: What is my phone talking to when I'm not even touching it?

When I finally inspected every outbound packet leaving my unrooted Android device, the answer wasn't just ad trackers. It was telemetry beacons firing every 45 seconds, silent SDK handshakes across three continents, andβ€”more recentlyβ€”background calls to outbound AI inference endpoints that the user was never told existed.

Most people think they need root access to stop this. They don't.

I spent 18 months of nights and weekends building TacUNS Firewallβ€”a zero-telemetry, no-root Android firewall. Here is a breakdown of what modern mobile traffic actually looks like under the hood, why the Android VpnService API is the most misunderstood security tool on your phone, and how I engineered a local packet filter to block 700,000+ threat domains on-device.

1. Your "Offline" Apps Don't Respect Offline Boundaries

On Android, android.permission.INTERNET isn't even classified as a "dangerous" runtime permission. Every app gets it automatically at install time without asking you.

Once an app has INTERNET, it has a blank check. During my packet captures, here is what a typical "simple offline utility" app actually does within 10 seconds of launch:

  1. Queries 4 to 6 third-party tracking and attribution DNS records (Adjust, AppsFlyer, Firebase, Unity Ads, Facebook Graph).
  2. Opens persistent TLS sockets to behavioral analytics brokers.
  3. Retries blocked connections with aggressive exponential backoffβ€”sometimes hammering the network stack hundreds of times an hour if a domain doesn't resolve.

The app doesn't need the internet to function. It takes it anyway because stock Android gives you no native per-app toggle to cut off Wi-Fi and Mobile Data independently.

2. The VPN Permission Is the Feature, Not the Catch

Whenever security-conscious users install a local Android firewall and see the system prompt:

"TacUNS Firewall wants to set up a VPN connection that allows it to monitor network traffic..."

Their immediate reaction is suspicion: "Wait, is my traffic being routed through somebody's remote cloud server?"

Here is the architectural reality of unrooted Android: Without root (iptables / nftables access), Android provides exactly one official OS API to inspect and filter raw packets across the device: VpnService.

Instead of sending your packets over the internet to an external VPN provider, a local firewall creates a virtual tun0 loopback interface directly inside your phone's RAM:

  • App Socket sends an outbound packet -> intercepted by the Virtual tun0 Interface (Local RAM).
  • If Rule = BLOCKED: The packet is dropped locally on-device. 0 bytes ever leave your phone.
  • If Rule = ALLOWED: The packet is forwarded directly through your physical Wi-Fi or 5G interface to its destinationβ€”with no external VPN server and zero proxy middleman.

No remote servers. No middleman proxy. Zero external latency. The VPN key icon in your status bar isn't a tunnel out of your phoneβ€”it is the gatekeeper keeping unauthorized packets inside your phone.

3. Outbound AI Traffic Is the New Shadow Telemetry

In the last few months, mobile packet logs changed dramatically. Beyond standard ad networks, everyday apps started embedding third-party AI wrappers, background LLM summarization hooks, and remote inference APIs directly into the client side.

Many apps now ship UI context, clipboard data, or usage metadata payloads directly to external AI API endpoints without displaying an explicit "AI processing" prompt to the user.

To expose this, I built AI Radar directly into TacUNS Firewall. Instead of treating all HTTPS port 443 traffic as an opaque blob, AI Radar flags known AI inference domains, LLM API gateways, and AI telemetry endpoints in real timeβ€”letting you see which apps on your phone are quietly talking to AI backends and block them with a single tap.

4. Engineering the Block Engine: 700,000+ Domains With Zero Battery Drain

The hardest part of building an on-device firewall isn't dropping a packetβ€”it's doing it 24/7 without turning the phone into a pocket heater.

If your packet loop allocates memory recklessly or runs linear searches against a huge blocklist on every DNS query, you will destroy battery life and trigger Android's background task killer.

Here is what runs under the hood in TacUNS Firewall:

  • 700,000+ Unified Threat & Tracker Blocklist: Pre-indexed for sub-millisecond lookups so domain resolution checks happen before the connection handshake even starts.
  • Granular Per-App Control Matrix: Separate one-tap toggles for Wi-Fi vs. Mobile Data on every user and system app.
  • Live Connection Map & Real-Time Packet Feed: Inspect exact destination IPs, ASN ownership, countries, and domain names as apps attempt to phone home.
  • AI Radar: Dedicated real-time detection and blocking for silent outbound AI traffic.
  • 100% Local & Zero Telemetry: No account creation, no cloud dependency, no paid APIs, and zero analytics SDKs inside the security tool itself.

Audit What Your Phone Is Doing Tonight

If you haven't inspected your phone's outbound traffic recently, run a local capture overnight. Look specifically at the apps you think are completely offline.

I'd love to hear from other Android and security folks in the comments:

  1. What is the weirdest outbound connection you've ever caught an "offline" app making?
  2. For those building with VpnService, what's your cleanest approach for keeping memory footprint ultra-low on huge domain blocklists?
πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.