National Cyber Warfare Foundation (NCWF)login

Inside bad_query: how a proof of concept exposes iOS 26 and 27 sandbox container paths


0 user ratings
2026-11-11 05:27:00
milo
Red Team (CNA)
"Inside

bad_query is a research proof-of-concept demonstrating a sandbox escape on iOS 26.0–26.6.1 and 27.0b4, published for developers and defenders studying container isolation on Apple platforms.








ToolforcequitOS/bad_query — proof-of-concept sandbox escape affecting iOS 26.0–26.6.1 and 27.0b4
CategoryMobile security research / proof-of-concept (C)
Primary UseStudying how iOS sandbox boundaries around Containers/Data paths can be violated, for hardening and defensive research on jailbroken or lab devices
Safe UseStrictly for authorized research on devices the researcher owns — the author explicitly states it is a PoC for developers and not meaningfully usable
Telemetry NoteUnusual reads or writes under /var/mobile/Containers/Data/InternalDaemon and /var/containers/Data/System from a third-party app context would be strong sandbox-violation indicators for MDM and endpoint tooling to alert on

bad_query is a proof-of-concept published by forcequitOS that demonstrates a sandbox escape affecting iOS 26.0 through 26.6.1, as well as the 27.0b4 beta. The repository is deliberately modest about its maturity: the README opens by stating plainly that this is a proof-of-concept for developers and not anything meaningfully usable at the moment. That framing matters, because it positions the project as a disclosure and research artifact rather than an operational tool, and it is the correct way to read everything else in the repo. The project is written in C, carries around 310 stars, and lives on the main branch with no license file, which is worth noting for anyone considering redistribution or incorporation into a larger research corpus.


What the PoC actually demonstrates, per the README, is the ability to reach a specific set of filesystem paths that the iOS sandbox is supposed to make inaccessible to a sandboxed process. The enumerated targets include /var/containers/Data/System and /var/containers/Shared/SystemGroup/* on iOS 27, along with the application container hierarchy under /var/mobile/Containers/Data/Application/*. These are the directories where per-app data lives, and being able to traverse them from an unauthorized context is precisely the class of bug a sandbox is designed to prevent. The README also lists /var/mobile/Containers/Data/InternalDaemon/* and /var/mobile/Containers/Data/PluginKitPlugin/*, extending the reach into daemon and extension storage that ordinary apps should never see.


The most operationally interesting entry in the list is /var/mobile/Containers/Shared/AppGroup/*, which the author notes requires an App Group sacrifice on iOS 26, while on iOS 27 the parent /var/mobile/Containers/Shared/AppGroup path is directly reachable. The phrase App Group sacrifice suggests the attacker-controlled app must forfeit its own App Group entitlement or container to reach other applications' shared containers — a trade-off that limits how attractive the primitive is for real-world abuse. That Apple appears to have changed the constraint between major versions is exactly the kind of regression detail that makes this repository valuable to platform-security researchers tracking how iOS container isolation evolves.


A footnote in the README adds that the technique might also work on iOS 18, but the author has not tested it at all, an honest hedge that tells you the underlying issue may predate iOS 26 by a considerable margin. For defenders and platform engineers, that possibility widens the population of potentially affected devices well beyond the explicitly confirmed range. It also implies the flaw may sit in long-lived sandbox machinery rather than in newly introduced code, which usually correlates with a broader attack surface than a single-version regression would suggest.


The tool's name, bad_query, hints at the underlying mechanism — most likely an improperly validated query or lookup against a system service that mediates filesystem access, where the sandbox broker fails to constrain the queried path. That is speculation beyond the README, which contains no code walkthrough, no crash logs, and no explanation of the vulnerable component. The document is intentionally sparse: a version range, a path list, and two caveats. Analysts should treat the path list as the factual core and resist inferring more than the author has published. The repo functions as evidence that the sandbox boundary is violable on the listed builds, not as a tutorial on how the violation occurs.


For authorized security teams, the defensive value here is concrete. The enumerated paths double as a detection checklist: any third-party application context observed opening files under /var/containers/Data/System, /var/mobile/Containers/Data/InternalDaemon/*, or another app's /var/mobile/Containers/Data/Application/* container is, by construction, violating the sandbox contract. MDM platforms, forensic tooling on managed devices, and enterprise mobile threat detection products can key on exactly these path prefixes. On iOS 27 deployments, the newly reachable /var/containers/Shared/SystemGroup/* tree deserves particular attention because system group containers historically hold privileged shared state.


From a responsible-disclosure standpoint, the publication pattern — working PoC code paired with an explicit statement that it is a developer artifact — suggests coordinated or at least deliberate disclosure by a researcher who wants the issue understood and fixed rather than exploited. There is no weaponization scaffolding in the README: no droppers, no persistence logic, no target selection, no infrastructure. The absence of a license file is a common signal of a temporary research repo that may be taken down or restructured after vendor patching, so teams citing it in threat models or internal reports should archive the factual details rather than rely on the link persisting.


Where bad_query fits in an authorized workflow is narrow but real. Platform security engineers can use it to validate that a patch actually closes access to the listed containers on their test devices, and jailbroken-device researchers can use it as a building block for understanding container mediation on modern iOS. It should not be expected to do more than demonstrate path access: the author's own statement that it is not meaningfully usable sets that expectation clearly. Red teams operating under written authorization should also note that the App Group sacrifice constraint on iOS 26 makes stealthy chaining harder than a naive reading of sandbox escape implies.


The version coverage itself is informative for patch prioritization. iOS 26.6.1 is the last affected release in the 26 series per the README, and 27.0b4 is affected in the beta line, which means the fix presumably landed either in a subsequent 26.x security update or in a later 27.0 beta. Teams running device fleets should confirm which minor release actually remediates the issue against Apple's own security advisories rather than the README alone. The untested iOS 18 possibility adds a second, older population to that verification effort, even if confidence there is low.


In sum, bad_query is a compact, honest research artifact: a C proof-of-concept that documents which sandboxed container paths are reachable on iOS 26.0–26.6.1 and 27.0b4, with clear caveats about usability and an unverified note about iOS 18. Its worth to the community is as evidence and as a detection specification, not as an attack tool. Defenders get a canonical list of paths that should never appear in a sandboxed app's I/O profile, and platform researchers get a data point on how container isolation regressed across two major versions. Both audiences are best served by treating the repository exactly as its author framed it — a developer-facing proof of concept, published for understanding rather than for use.



Official project repository for forcequitOS/bad_query.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/inside-badquery-how-proof-of-concept.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.