Apr 30, 2026·5 min read·50 visits
An off-by-one error in Netfoil's domain matching logic ignores the first character of incoming domains, allowing attackers to bypass DNS filters by adding a prefix to allowed domains.
Netfoil versions prior to v0.2.1 contain an off-by-one logic error within the custom suffix trie implementation used for domain matching. This flaw allows an attacker to bypass DNS allowlist configurations by prepending arbitrary characters to approved domain names.
Netfoil acts as a DNS proxy with built-in filtering capabilities. It relies on a custom suffix trie data structure to manage allowed and denied domains. The vulnerability resides in this custom implementation, specifically within the insertion and exact match logic responsible for enforcing security policies.
The flaw is classified as an off-by-one error (CWE-193), which directly leads to improper authorization (CWE-285). Because the proxy relies entirely on this suffix trie to enforce access policies, a flaw in the matching logic invalidates the primary security boundary of the application.
Any attacker capable of routing DNS requests through the vulnerable Netfoil instance can exploit this flaw. By manipulating the requested domain string, the attacker forces the proxy to process unauthorized domains as if they were present on the configured allowlist.
The root cause is a loop termination condition error within the suffixtrie/suffixtrie.go module. The application implements its own suffix trie to handle domain lookups. To process strings from right to left (TLD to subdomain), the functions Insert and MatchExact iterate backward over the byte slice of the provided domain string.
The for loop governing this backward traversal uses the condition i > 0. Because Go employs zero-based indexing, this condition dictates that the loop terminates immediately after processing the character at index 1. Consequently, the character at index 0—the first character of the string—is consistently omitted from both the insertion and matching operations.
When the system administrator adds example.com to the allowlist, the Insert function only records xample.com within the trie nodes. Subsequently, when the MatchExact function processes an incoming request for fxample.com, it also drops the leading character and evaluates xample.com. The resulting match allows the unauthorized domain to bypass the filter.
A secondary logic error existed in the MatchSuffix function. This function returned true when evaluated against an empty byte slice. Depending on prior input sanitization stages, this flaw facilitates further filter bypasses by exploiting null or empty domain queries.
The underlying flaw is evident when examining the pre-patch state of the suffixtrie.go source file. The backward iteration logic failed to account for the zeroth index.
// VULNERABLE CODE: suffixtrie.go
func (t *Trie) Insert(word []byte) {
// ...
for i := len(word) - 1; i > 0; i-- { // Flaw: i > 0 ignores index 0
c := word[i]
// node traversal logic
}
}The fix applied in commit 0ca054acf97b011e4fdd40392475c7786b975ec3 corrects the loop boundaries. The condition is updated to i >= 0, ensuring the complete byte slice is processed.
// PATCHED CODE: suffixtrie.go
func (t *Trie) Insert(word []byte) {
// ...
for i := len(word) - 1; i >= 0; i-- { // Fix: includes index 0
c := word[i]
// node traversal logic
}
}The patch also hardens the MatchSuffix method. A guard clause is introduced to explicitly return false if the length of the input word is zero, neutralizing the secondary bypass vector.
// PATCHED CODE: suffixtrie.go (MatchSuffix)
func (t *Trie) MatchSuffix(word []byte) bool {
if len(word) == 0 { // Fix: empty slice check
return false
}
// ...
}Exploitation requires network access to route DNS queries through the Netfoil proxy. The attacker must possess prior knowledge of at least one domain explicitly configured on the target's allowlist to construct a valid payload.
The attack payload consists of a standard DNS query modified to prepend a single, arbitrary character to the known allowed domain. If the policy permits google.com, the attacker issues a DNS A or AAAA record query for xgoogle.com or 1google.com.
The Netfoil proxy receives the query and processes it through the vulnerable MatchExact function. The function truncates the leading x or 1, successfully matching the truncated string google.com against the similarly truncated entry in the trie. The proxy then resolves and forwards the traffic for the unapproved domain.
The vulnerability results in a total failure of the primary authorization control mechanism within the Netfoil proxy. The integrity of the DNS filtering policy is compromised, allowing arbitrary egress traffic that the administrator intended to block.
In environments where Netfoil serves as a critical defense-in-depth layer—such as preventing malware command-and-control (C2) communication or enforcing corporate acceptable use policies—this bypass neutralizes those protections. Attackers route malicious traffic disguised as legitimate, authorized flows.
The impact is limited to the proxy's routing decisions. The flaw does not grant memory corruption capabilities, nor does it allow for direct remote code execution on the Netfoil host itself. The system's confidentiality and availability remain intact, while the integrity of the filtering rules is completely broken.
The primary remediation is to deploy Netfoil version v0.2.1. This release contains the corrected loop boundaries and the empty slice validation logic necessary to secure the domain matching processes.
System administrators must audit historical DNS logs to detect potential exploitation prior to patching. The detection signature involves identifying requests for domains that exactly match allowed domains but possess one additional prefix character. These requests frequently result in NXDOMAIN responses from upstream resolvers if the attacker-specified domain is not actually registered.
As a defense-in-depth measure, administrators must implement egress network filtering independently of DNS controls. A firewall rule restricting outbound traffic to approved IP ranges provides a secondary enforcement layer that mitigates the impact of DNS-level bypasses.
| Product | Affected Versions | Fixed Version |
|---|---|---|
Netfoil tinfoil-factory | < 0.2.1 | v0.2.1 |
| Attribute | Detail |
|---|---|
| Vulnerability Type | Incorrect allowlist enforcement |
| CWE ID | CWE-193, CWE-285 |
| Attack Vector | Network |
| Impact | Security feature bypass (DNS filtering) |
| Exploit Status | Unauthenticated Bypass |
| Patch Status | Fixed in v0.2.1 |
An off-by-one error occurs when a loop iterates one time too many or one time too few, leading to incorrect processing of boundaries.
CVE-2026-14265 (GHSA-c5q4-97jw-jggh) is a high-severity Remote Code Execution (RCE) vulnerability in the Amazon Web Services (AWS) Advanced JDBC Wrapper versions 3.3.0 through 4.0.0. The defect resides in the `RemoteQueryCachePlugin` and its underlying `CachedResultSet` implementation, which uses an unfiltered `java.io.ObjectInputStream` to deserialize cached SQL query results retrieved from external Redis or Valkey backends. An attacker with write access to the shared cache infrastructure can inject serialized Java gadget chains into cache keys, achieving arbitrary code execution within the JVM context of any application server consuming the cached entries.
CVE-2026-63672 is an open redirect and insecure Identity Provider (IdP) selection vulnerability in the SAML Single Sign-On (SSO) authentication module of EGroupware. In affected versions, the login method in api/src/Auth/Saml.php accepts an unauthenticated HTTP request parameter (idp) and passes it to the underlying SimpleSAMLphp library after only verifying that the string begins with https://. Because the input is not validated against the application's configured whitelist of trusted identity providers, an attacker can construct a malicious link that redirects authenticating users to an arbitrary, attacker-controlled SAML Identity Provider.
CVE-2026-62336 (GHSA-xhv5-8fpq-g7hf) is a high-severity local privilege escalation, arbitrary file overwrite, and denial-of-service vulnerability in qbee-agent, the client daemon for the qbee.io IoT device management platform. Prior to version 2026.27, the root-privileged agent failed to validate path components against symbolic links during directory creation and file opening operations in app/configuration/file_manager.go. Local unprivileged users can exploit this flaw by planting symlinks in user-controlled configuration paths or predictable temporary staging locations, causing the daemon to overwrite, truncate, or change ownership of sensitive root-owned system files.
CVE-2026-110782 is an authentication bypass and cryptographic signature verification failure in the SimpleSAMLphp SAML2 library (simplesamlphp/saml2). Resulting from an incomplete fix for CVE-2026-49283, the HTTP-Artifact binding implementation verifies the outer ArtifactResponse signature but unconditionally returns unsigned embedded SAML Responses without verifying signatures or validating that the embedded issuer matches the artifact issuer. In multi-IdP federation environments, an attacker controlling one trusted Identity Provider (IdP) can forge arbitrary identity assertions claiming to originate from another trusted IdP.
CVE-2026-110789 (GHSA-rvfr-cqwq-rc4j) is a high-severity pre-authentication Denial of Service (DoS) vulnerability in the @libp2p/crypto package of the js-libp2p networking stack prior to version 5.1.22. An improper length validation flaw in the ASN.1 DER decoder allows an unauthenticated remote peer to send a crafted RSA public key during the Identify protocol exchange, forcing the parser into a synchronous loop over attacker-claimed length values. Because this loop executes within a single Node.js event-loop tick prior to identity or cryptographic signature verification, it bypasses application timeouts, stalls the event loop for 4 to 5 seconds per connection, and transiently allocates up to 2 GB of memory.
CVE-2026-119793 (GHSA-x2vm-cf3p-m2w8) is a resource consumption vulnerability in the @libp2p/gossipsub module of the js-libp2p ecosystem. Prior to @libp2p/gossipsub version 17.0.0 and js-libp2p version 3.3.9, the GossipSub implementation processed incoming subscription RPC messages without enforcing per-peer or global limits on the number or cumulative byte size of subscribed topics in its default configuration. An unauthenticated remote peer can exploit this flaw by streaming continuous batches of unique topic subscription strings over an established connection, causing unbounded growth of the internal topics Map. This leads to V8 heap exhaustion (Out-Of-Memory crash) and severe CPU starvation on the main event loop during peer disconnection teardown.