Library / SDK
pantsufan/Magisk-Ad-Blocking-Module avatar
pantsufan/Magisk-Ad-Blocking-Module

Magisk-Ad-Blocking-Module: hosts file ad blocking on a rooted Android

Magisk module to block ads on android

572 stars22 forksUnknownLicense varies

At a glance

What is it?
The Magisk-Ad-Blocking-Module is a Magisk module that blocks ads, adult sites and in-app advertising by pushing a hosts file onto the device at boot, with a separate build for unrooted phones and another without the adult-site list. The whole mechanism is one file and a boot-time hook.
Who is it for?
Adopt this module if you have a rooted Android phone and want system-wide ad blocking that applies before any app starts, since a Magisk hosts file is applied at boot and covers apps that ignore per-app VPN-based blocking. Do not adopt it if you need per-app controls or a rule set you can edit, since this is a single host list with no user-facing rule engine.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
GitHub does not report a main language for this repository.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

One hosts file and a boot-time hook

The mechanism is deliberately small. The repository tree has four entries: .github/, README.md, hosts and logo.png. The hosts directory holds the host lists, and the module's job is to get one of those lists onto the device's hosts file early enough that applications never reach the ad servers.

A Magisk module runs at boot and can modify system files, which is what makes this possible without touching the running operating system's partition directly. The README credits @topjohnwu for Magisk, so the module is built on the standard Magisk module format rather than on anything bespoke.

The design choice is hosts file blocking rather than DNS filtering. Those are different approaches with different consequences, and the difference is the main thing to understand before choosing this over a network-level blocker. A hosts file maps hostnames to addresses locally, so a request to a blocked hostname never leaves the phone. Nothing is resolved, no query is sent, and there is no server in the path that could be slow or unreachable. The price is that the list is a flat set of hostnames with no pattern matching, no per-app control and no easy way to allow one domain and block another, because there is no rule engine at all.

The result is a module whose entire behaviour is a list, and whose quality is entirely the quality of that list.

Three lists, three different scopes

The feature list is short: blocks ads, blocks porn sites, and blocks Android app ads. The third of those is the one that distinguishes a hosts file approach from a browser-level blocker, because the advertising inside an installed app is served from the app's own domain, not from a third-party ad network that a browser extension could match on a URL pattern.

The download section splits the project into three artifacts, and the differences matter.

The Magisk Module is the main build, the one that requires a rooted device. Then there is a link labelled Non Rooted Device?, which points at a specific 1.0 release tag in a different repository, the adblocking-module one. And the third is a Version Without Porn Block, hosted in yet another repository under the BlockAds name.

So the same project is published three ways, differing in how they are installed and in what they block. The non-rooted variant is the interesting one technically, because a hosts file on an unrooted device cannot be replaced persistently, which is exactly the constraint that a root solves, and the fact that it is available at all suggests a different installation route for that case.

The credit list names the data sources, and it is the most useful part of the README for evaluating quality. The host file comes from OISD, from 1Hosts by badmojr, and from the Anti-Porn HOSTS File by 4skinSkywalker. The module itself also credits Zackptg5's MMT-Extended for the Magisk template it is built from, so the packaging is derived work and the blocking data is imported from other people's lists.

That division is worth holding on to. The author of this module is maintaining the packaging and the update pipeline, not the blocklists themselves, and the README says as much when it explains the update policy.

Updates happen when the host file changes, and only then

The Updates section states the release policy in one sentence: the module would be updated if there are any major changes to the host file.

That is a narrower policy than a typical application and it is the correct one for this kind of project. A Magisk module that replaced a file on every release would churn users' devices for no reason, because the module contributes almost nothing of its own. What matters is the content of the hosts list, so the module is versioned to track the list.

The recent release history matches that reading. v3.82 shipped on 2026-10-15, v3.81 on 2026-10-01 and v3.80 on 2026-09-15, which is roughly a release every two weeks rather than a rapid cadence. The last push was on 2026-10-20, so the branch and the newest tag are close together, which is what you want to see in a project whose releases follow its data source.

The module also points at a Telegram channel, with a link saying to join it to get updates faster. That is a reasonable distribution model for a small project, but it has a consequence for anyone assessing the project: the fastest path to a new list runs through a chat channel rather than through a release feed, and a release feed is what you would want to watch in order to know when a device needs updating.

The documentation site is at https://pantsufan.github.io/Magisk-Ad-Blocking-Module/, and the releases live in a separate adblocking-module repository, which is where the Magisk Module link points.

Where a hosts file approach stops being enough

There are three limits, and the first is structural rather than a bug.

The first is that a hosts file cannot express intent. It is a list of hostnames mapped to a null address, so blocking a domain that also serves something you need takes everything down with it, and there is no allowlist, no regex and no per-app scoping. The list has to be curated upstream, which is why the credit list names three separate host sources, and why the adult-content list is a separate artifact you can opt out of. If you need to unblock one hostname for one app, this module cannot express that and you have to edit the file yourself.

The second is the gap between list update and device update. The module version and the host list version are the same thing here, so a device only benefits when the user installs a new release. On a phone that was set up once and forgotten, the list on it is as old as the day it was installed, and the list of blocked ad domains is a moving target that new entries join all the time. A module that is not updated is a module that slowly stops blocking anything new.

The third is the root requirement. The main build needs a rooted device, and rooting a phone is a decision with security consequences, including for the apps you install afterwards. The unrooted variant exists, but it is a separate release at version 1.0 in a different repository, which suggests it is not the maintained path.

There is also an honest scope limit in what a hosts file can reach. Advertisements served from a domain that also delivers the content of the app, or ads delivered over a connection the app establishes rather than a name the system resolves, are not something a hostname list can intercept. This module's feature list claims to block Android app ads, and it will block many of them, but the ones that share a domain with the app itself are out of reach for any list-based approach.

How it differs from DNS-level and per-app blocking

The realistic alternatives fall into two groups, and the difference in approach is worth being precise about.

The first group is DNS-based blocking, in the shape of a private DNS or VPN-based blocker with a filter subscription. The difference is that the filtering happens on a server rather than on the device, which means the list can be updated without touching the phone, that rules can be expressed with pattern matching, and that you can have per-app exceptions because the app's traffic is distinguishable. The cost is that a server sits in the path, that it can be slow or unreachable, and that it sees every domain you look up.

The second group is per-app blocking, the kind an app like a firewall-style blocker provides. The difference is that it works at the app level, so an ad in a specific app can be stopped while the same domain works elsewhere, and the app under the user's control rather than the whole system. The cost is that it is per-app, so it is a lot of configuration, and it does not cover the system surfaces that a hosts file does cover.

This module sits deliberately at the other end from the DNS approach. Nothing is resolved, so it is fast and works offline, and it applies to everything on the device including apps that would defeat a per-app rule set. What it gives up is exactly the dynamic update and the expressiveness.

There is a fair argument that the right choice depends on how much you care about the list staying current. A user who installs a fresh release every couple of weeks gets close to the DNS approach's freshness with none of its infrastructure. A user who installs once gets a list that decays.

Editorial conclusion

Adopt this module if you have a rooted Android phone and want system-wide ad blocking that applies before any app starts, since a Magisk hosts file is applied at boot and covers apps that ignore per-app VPN-based blocking. Do not adopt it if you need per-app controls or a rule set you can edit, since this is a single host list with no user-facing rule engine. Before installing, check the release you are on, because the last push was on 2026-10-20 with v3.82 released on 2026-10-15, and note that the licence is not stated in the repository metadata.

Frequently asked questions

How does the Magisk-Ad-Blocking-Module work?

It is a Magisk module that applies a hosts file to the device at boot, so requests to blocked hostnames never leave the phone. The repository holds a hosts directory with the lists, and the module is built on the standard Magisk module format, crediting @topjohnwu for Magisk and Zackptg5's MMT-Extended for the template.

Which host lists does the module use?

The credits name OISD, 1Hosts by badmojr and the Anti-Porn HOSTS File by 4skinSkywalker as the sources for the host file. The README states the module is updated if there are any major changes to the host file.

Does the module work on an unrooted phone?

There is a non-rooted build, published separately as version 1.0 in the adblocking-module repository, with a link labelled Non Rooted Device? in the download section. The main Magisk Module download is the rooted-device path.

Can I use this module without the adult site blocking?

Yes. A separate Version Without Porn Block is published in the BlockAds repository, linked from the download section alongside the main module and the non-rooted build.

How often are new versions released?

The recent releases are v3.82 on 2026-10-15, v3.81 on 2026-10-01 and v3.80 on 2026-09-15, roughly every two weeks, because the module is versioned to track changes to the underlying host file rather than to its own code.

Official sources

  1. Issues
  2. pantsufan/Magisk-Ad-Blocking-Module on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/pantsufan-magisk-ad-blocking-module.svg)](https://hysenlabs.com/projects/pantsufan-magisk-ad-blocking-module)

Was this useful?