---
title: Filter Suspicious Queries
canonical: https://wpsecurityninja.com/docs/firewall/filter-suspicious-queries/
---
**Filter Suspicious Queries** is the free Web Application Firewall layer in Security Ninja. It inspects incoming requests and blocks many common exploit patterns before they reach WordPress.

The rules are based on the [8G Firewall](https://perishablepress.com/8g-firewall/) by Jeff Starr (Perishable Press), adapted for WordPress.

## Where to enable it

1. Go to **Security Ninja → Firewall**.
2. Open the **Settings** tab.
3. Turn on **Filter Suspicious Queries**.

This toggle is available in the free plugin. You do not need Pro to use it.

## What it checks

When enabled, Security Ninja filters suspicious patterns in:

* Request URI
* Query string
* User agent
* Referrer

These checks run on their own. They are separate from Cloud Firewall bad-IP lists, country blocking, and **Prevent Banned IPs from Accessing the Site** (Pro).

The request path and the query string are checked separately. A long token in a query string (a WooCommerce download link, for example) is not treated as an exploit path.

## Ordinary text that is not an attack

The rules look for exploit shapes, not for English words that happen to contain the same letters.

* A person's name such as "Charlotte (Charlie)" is not a function call. `char()`, `eval()`, and `benchmark()` are still blocked. The name has to stand on its own and be followed by a parenthesis. Words such as "evaluation" or "medieval" are not `eval()`.
* A phrase such as "please select one" is not SQL. `select`, `insert`, `update`, and `delete` are still blocked when SQL follows, such as `FROM`, `INTO`, or `SET`.
* A parameter that only ends in `_request`, such as `download_request`, is not treated as access to PHP's request array.
* A bare `...` in a query value (a masked card number, or text cut short) is not path traversal. Real traversal such as `../`, `..\\`, and encoded variants is still blocked.

If a real checkout or webhook is still blocked, see [WooCommerce and SureCart store protection](https://wpsecurityninja.com/docs/firewall/woocommerce-rate-coupon-protection/). On those payment requests, a few query rules that trip on tokens are skipped. The rest of the firewall still runs.

## Early Firewall

On Pro, [Early Firewall](https://wpsecurityninja.com/docs/firewall/early-firewall/) can run these same rules before WordPress loads. The rules are compiled into a config when you enable it, when you save Firewall settings, and after a plugin update. That compiled config is what Early Firewall uses. The WordPress-hooks firewall still evaluates the filters on each request.

If you change a rule with a filter, save Firewall settings or click **Verify** on the Early Firewall panel so the compiled config picks it up. A filter that only changes its result when a certain query argument is present can be saved for every visitor. Use a fixed change. Details: [Customizing firewall filter rules](https://wpsecurityninja.com/docs/filters-hooks/customizing-firewall-filter-rules/).

## Hostname reverse-DNS checks

The 8G ruleset can also match visitor hostnames from reverse-DNS lookups. In current versions, **hostname checks are off by default**. URI, query string, user agent, and referrer rules still run without them.

Hostname matching was a common source of false positives on ordinary browser traffic. Developers who need the old behavior can re-enable it with the [`secnin_cf_check_blocked_hosts` filter](https://wpsecurityninja.com/docs/filters-hooks/secnin_cf_check_blocked_hosts/).

To customize hostname, URI, query, or referrer lists, see [Customizing firewall filter rules](https://wpsecurityninja.com/docs/filters-hooks/customizing-firewall-filter-rules/) and [Filter blocked_hosts_items](https://wpsecurityninja.com/docs/filters-hooks/filter-blocked_hosts_items/).

## Temporary login plugins

Recognized temporary-login links skip the query filter when the matching plugin is active:

* Temporary Login Without Password
* One Time Login
* Magic Login
* Login Links

Those URLs use token query parameters that can look like exploit patterns. Security Ninja allows them through only when the plugin is installed and active. Details: [Temporary login plugins](https://wpsecurityninja.com/docs/firewall/temporary-login-plugins/).

## Related

* [8G Firewall rules (background)](https://wpsecurityninja.com/docs/firewall/8g-firewall-rules/)
* [Visitor IP detection](https://wpsecurityninja.com/docs/firewall/visitor-ip-detection/)
* [How to use the firewall](https://wpsecurityninja.com/docs/firewall/how-to-use-the-firewall/)
* [Early Firewall](https://wpsecurityninja.com/docs/firewall/early-firewall/)
* [WooCommerce and SureCart store protection](https://wpsecurityninja.com/docs/firewall/woocommerce-rate-coupon-protection/)
* [Automatically validated crawlers](https://wpsecurityninja.com/docs/firewall/automatically-validated-crawlers/)
* [Temporary login plugins](https://wpsecurityninja.com/docs/firewall/temporary-login-plugins/)
