Cisilino Site Defense Network

By Matteo Cisilino

10+ active installationsVersion 1.0.19

Blocks login brute-force attempts in .htaccess, optionally exchanges hostile IPs with the Cisilino network, offers whitelisting and basic hardening.

Description

Cisilino Site Defense Network watches failed login attempts on your
WordPress site. Once an IP exceeds a configurable threshold, it gets
blocked locally by adding a rule to the site’s .htaccess file
(compatible with both Apache 2.4 and 2.2).

Documentation: guides for every feature (in Italian) are published at
https://www.cisilino.com/category/csdn/.

Blacklist and log

A single page (Settings > Cisilino Site Defense Network) shows:

  • a unified blacklist (IPs blocked locally, received from the network, or
    added manually), with an “Unblock” button on each row;
  • a log of the last 50 detections;
  • a manual ban/unban override for a specific IP, with an optional
    expiry (permanent, 1 hour, 6 hours, 24 hours or 7 days);
  • a whitelist of trusted IPs (e.g. your office network): unlike an
    unban, a whitelisted IP is not even counted as a failed attempt.

Activity log (local, with its own retention)

A dedicated tab (“Registro attivita”) records what happens on the site:
logins and logouts, failed login attempts, user creation/deletion/role
changes, content published or deleted, comments, media, plugin and theme
activation/update, WordPress core updates, changes to significant core
settings, menus, widgets, theme/plugin file edits from wp-admin, and
content exports. Each group can be turned on or off individually.

Plugin settings changes are recorded too, with a before/after of the
fields that actually changed: this plugin’s own settings in full detail
(panel connection, whitelist, hardening, IP overrides, activity log
options), and other plugins’ settings when they are declared through the
WordPress Settings API. Values of options whose name suggests a secret
(key, token, password, licence…) are never recorded – only the fact
that they changed.

Emptying the local log, deactivating and uninstalling the plugin are
themselves recorded as events. Emptying the local log never sends any
deletion command to the panel: the history already delivered there stays
untouched.

Deactivating or uninstalling the plugin is itself recorded, and the plugin
tries to deliver that final entry to the panel before removing anything —
so the panel can tell “the plugin was removed on purpose” apart from “the
site went silent”.

Each entry is written locally first, in its own table, and then
delivered to the panel immediately – at the end of the request in which
it happened, never inside the action itself, so a visitor never waits
for the panel. If the panel is unreachable the entry simply stays queued
and is retried: delivery is delayed, entries are not lost. The daily
retention cleanup only removes entries the panel has already confirmed,
so a long panel outage can never make undelivered events disappear.

The retention on the panel side is a separate setting, managed by the
customer in the panel: shortening the local retention does not shorten
the panel’s history, and vice versa.

Integrity self-check

The plugin verifies the MD5 hashes of its own files against a manifest
shipped with the release (or, if that is absent, a snapshot taken at
activation), once a day and on demand. Modified, missing and unexpected
files are all reported – a web shell dropped into a plugin folder is one
of the most common ways an infection hides. The result is also sent to
the panel, because a copy of that information outside the machine is the
one an attacker on that machine cannot edit.

Known limit, stated plainly: whoever can already write to the files can
also rewrite the manifest or disable the check. This detects tampering,
it does not prevent it.

File upload monitoring

Uploads are recorded even when they do not go through the media library
– plugin forms, admin-ajax endpoints, arbitrary theme uploads – which is
where most web shells actually get in. Executable extensions are
flagged, including double extensions such as “harmless.php.jpg”, and can
optionally be rejected outright (off by default, since it can break
plugins that legitimately upload archives).

Site debug log (optional)

A dedicated tab turns an extra PHP error log on and off without editing
wp-config.php, for a time you choose (1 hour, 24 hours or 7 days). It
adds to debug.log and the web server log, it never replaces them, and
nothing is deleted or truncated automatically: a file that outgrows the size you choose (1 to 50 MB) is closed, compressed
to .zip and checked before the original is removed, and the log stops (and says so) at a 200 MB
cap rather than overwrite older data. Files live in a randomly named
folder inside uploads, protected by .htaccess; the log refuses to start
if that folder turns out to be reachable from the internet. Limits: it
sees errors raised after this plugin loads, not those suppressed with @.

Optional hardening

A dedicated section (everything disabled by default, must be turned on
manually) lets you:

  • block PHP execution inside wp-content/uploads;
  • disable directory listing where no index file exists;
  • block direct access to wp-config.php, .htaccess, readme.html,
    debug.log;
  • block custom paths;
  • disable XML-RPC;
  • block user enumeration via ?author=N.

Paranoic Hardening (optional, HTTP security headers)

A separate section, also disabled by default, sends optional security
headers (via WordPress, not .htaccess – works even without
mod_headers): X-Content-Type-Options: nosniff,
X-Frame-Options: SAMEORIGIN, Referrer-Policy:
strict-origin-when-cross-origin
, and Strict-Transport-Security (HSTS).
Every option has an inline explanation of what it does and what it can
break. HSTS in particular can make a site unreachable to a browser that
already received it if the site later stops being served over https at
all times – saving it is refused outright if the request isn’t https, and
a self-test can check which headers actually reach a real request to the
site (a proxy/CDN in front of it may otherwise strip them silently).

Rate limiting

A dedicated tab limits two kinds of abuse, each with its own on/off switch, its
own thresholds and its own email alert switch:

  • Authors: a user who creates or publishes more than N posts/pages (default
    3) within a time window (default 5 minutes) is suspended for a configurable
    duration (default 1 hour) — they can no longer create or publish content,
    without their role being changed. The site’s main administrator can get an
    email with the recent content to review (the suspension never edits or
    deletes it). Active suspensions are listed in the tab and can be lifted
    manually before they expire. While a suspension is active, a notice in the
    WordPress admin tells the suspended user why and until when, and shows
    administrators who is suspended with a link to lift it. Only posts and pages
    count: installing or updating plugins, logins, auto-drafts, revisions, trashed
    items, media and other content types do not, and neither does anything that
    happens inside a WordPress installation or a temporary environment with a
    different table prefix (for example the test installation created by the
    Plugin Check plugin).
  • Guests (comments and contact forms): a non-logged-in visitor who sends
    more than N comments or Contact Form 7 submissions (default 2) within a
    short window (default 60 seconds) has their IP blocked for that kind of
    submission for a configurable duration (default 1 hour). Only the
    submission is rejected — the site’s pages stay reachable. The counter lives
    in its own table, so it works even on sites with comments disabled (where a
    contact form is the only entry point left).

A related, separate switch lives in the “User registration” tab: no new user
can be created without a valid email address, from any path (wp-admin, REST
API, WP-CLI, or a third-party plugin calling WordPress’s own user-creation
functions).

Cisilino network (optional)

If you configure the URL of a Cisilino Site Defense Network panel with a
customer code and API key (plugin Settings), the site periodically
(every 15 minutes) sends a digest of observed IPs and receives back the
IPs already banned for your customer by other sites in the network — so
a hostile IP detected elsewhere gets blocked here too, without waiting
for it to hit this site as well. See “== External services ==” below for
details on what is sent.

With no configuration at all, the plugin still protects the site on
its own
, locally only, with no outbound calls whatsoever.

Known limitations

Stated plainly, so nobody relies on protection that is not there:

  • Apache only for server-level rules. IP blocks and hardening rules
    live in .htaccess: nginx ignores them (see the FAQ).
  • PHP execution in uploads is blocked for the standard
    wp-content/uploads folder, in any letter case and also when WordPress
    sits in a subfolder. An uploads folder moved elsewhere with the
    UPLOADS constant is not covered. Use the “Verifica ora” button in the
    hardening tab to check what the server really does.
  • User enumeration is blocked on ?author= only. The REST endpoint
    /wp-json/wp/v2/users is a public WordPress API and stays open,
    because many themes and plugins depend on it.
  • Multisite. All sites of a network share one .htaccess, so the
    plugin settings are reserved to the network super admin. If several
    sites connect to the panel, each sync rewrites the same block of
    banned IPs: the last one wins. Connect one site per network.
  • Trusted IPs (whitelist): IPv4 accepts single addresses and CIDR
    ranges, IPv6 only exact addresses.
  • Site debug log: see its section above (errors raised before this
    plugin loads, or suppressed with @, are not seen).

Languages

The admin screens ship with English, French, Spanish and German
translations; the plugin’s source strings are Italian, used as the
fallback when none of those matches the site’s language. WordPress
picks the right one on its own, nothing to configure. Want another
language? Translate languages/cisilino-site-defense-network.pot and
send it over.

External services

This plugin can connect, only if you explicitly configure it (Settings >
Cisilino Site Defense Network > Panel URL, customer code, API key), to a
“Cisilino Site Defense Network” panel — a server that you or your
provider manage, not a third-party service imposed by the plugin. If
you leave these fields empty, the plugin makes no external calls at
all
: it works locally only.

Once configured, the plugin contacts the panel for one purpose:

  • IP digest exchange (every 15 minutes, or on the panel’s manual poll
    request): sends your customer code, the site URL, and a digest of
    failed login attempts observed since the last send (remote IP,
    attempted username, outcome, date/time — never the password). Receives
    back the list of IPs already banned for your customer. Endpoint:
    {panel URL}/api/ip-exchange/sync.
  • Activity digest (same request, same endpoint, only if the activity
    log and its “send to panel” option are both enabled): the activity
    entries not yet sent – date/time, WordPress user and role, IP, event
    group and action, name of the object involved, and a short summary.
    Never any password, and never the content of a post, comment or file.

The reference panel is a Cisilino product
(https://cisilino.com/). Since the URL is
configurable, a user could in theory point it at their own compatible
panel: in that case this disclosure applies to that panel, not to
Cisilino.

Installation

  1. Upload the plugin folder to /wp-content/plugins/.
  2. Activate the plugin from Plugins > Installed Plugins.
  3. (Optional) Go to Settings > Cisilino Site Defense Network and paste
    the panel URL, customer code and API key generated by the panel, to
    enable digest exchange with the network.

FAQ

Where is the documentation?

In the “csdn” category of the author’s site, one article per feature (in
Italian): https://www.cisilino.com/category/csdn/.

Do I need to configure anything to use the plugin?

No. As soon as it’s activated, it already detects failed login attempts
and blocks IPs that exceed the threshold in .htaccess, with no
configuration needed.

What happens if I don’t configure the panel connection?

The plugin keeps working normally, locally only: it detects and blocks
on its own, without exchanging or sending anything externally.

Where do I find the customer code and API key?

They are generated by the Cisilino Site Defense Network panel your site
is associated with, in the section dedicated to this plugin’s API keys.

Is the collected data shared with third parties?

Only if you explicitly configure a panel: in that case the attempted IPs
and usernames (never passwords) are sent to the panel you configured
yourself. See the “External services” section for full details.

Does it work on non-Apache hosting (e.g. nginx)?

IP blocking writes rules into .htaccess, so it requires Apache (or
LiteSpeed in compatible mode). Detection and panel-side management
remain available regardless; only the actual server-level block requires
Apache.

Does it work on WordPress multisite?

Yes, with two caveats. The settings are reserved to the network super
admin, because every site of the network shares the same .htaccess
and a single subsite admin could otherwise block paths or IPs for the
whole network. And the panel connection should be configured on one
site only: each sync rewrites the shared block of banned IPs.

What happens if I deactivate the plugin?

All rules written to .htaccess (IP blocking, hardening) are removed: a
deactivated plugin must not keep enforcing rules you can no longer see
or manage. Reactivating it restores everything exactly as it was: no
data is lost on deactivation.

Changelog

1.0.19

  • Trusted server IPs: the site’s DNS records are now used only when they include this server’s own address, so behind a CDN or reverse proxy the proxy’s address is never trusted and brute-force detection keeps working for every visitor. The result is computed once per request.
  • Cleaner input handling for the server address (SERVER_ADDR/LOCAL_ADDR is unslashed and sanitized explicitly), fixing the Plugin Check warnings.
  • A pinned user refused from a foreign IP now gets the same error as a wrong password, so the message does not reveal that the account exists.
  • In Settings > General the override form now preselects “Always unblock (unban)” instead of “Block (ban)”; a missing action is treated as unban.

1.0.18

  • New in Paranoic Hardening: users pinned to IPs. A listed user can sign in only from the IPs/CIDR ranges you associate with them; any other IP is refused (even with the right password) and banned on the first attempt. From an associated IP failed attempts are not counted and never trigger the instant ban, even if the name is on the forbidden list. Open sessions are not affected.
  • The server’s own public IPs (IPv4 and IPv6, from the current request and, only when the site’s DNS points to this very server, its DNS records, cached 10 minutes; never trusted behind a CDN or reverse proxy) are always treated as trusted and are never counted or banned, so moving the site to another server cannot get it banned by itself.
  • Ban duration is now optional: by default (empty) locally blocked IPs stay blocked until you unblock them. You can set a duration in minutes, hours or days under Settings > General > Ban duration; a value you already saved is kept.
  • Bans received from the panel that carry an expiry date are now really lifted when it passes: they leave the .htaccess block and the Blocked IPs list. Bans without an expiry stay permanent.
  • The Unblock button on the Blocked IPs list works for every source (local, panel, manual).
  • New cap on the number of rules in the .htaccess block (default 1000, configurable). When exceeded, the oldest temporary bans are left out first, then permanent ones, and a warning is shown. The General tab shows the current number of rules and the approximate size of the block.
  • One-time dismissible “What’s new” notice after an update, shown only to users who can manage the plugin.
  • Updated English, French, Spanish and German translations.

1.0.17

  • Debug LOG template revamp: Start and Stop buttons always in the same place and clearer texts. Thanks to Fabio Dreosso – dreosso.it.
  • New “Instant ban” option in the Hardening tab, off by default: bans on the first attempt the IP of anyone trying to sign in with a name from the list (“admin” to start with). It does not apply to real account names of the site, to trusted IPs or to private IPs, and it is suspended above 500 blocked IPs.
  • Debug LOG: if the files turn out to be reachable from the internet, the log still starts and the tab shows a warning, instead of refusing to start.
  • Under attack, .htaccess is rewritten at most once every 5 seconds, collecting all the new bans.

1.0.16

  • The plugin’s admin screens are now translatable: bundled translations for English, French, Spanish and German (the Italian strings in the source code are the default/fallback). WordPress loads the matching one automatically based on the site’s language, no setup needed.

1.0.15

  • New “Debug log” tab: records the site’s PHP errors in its own file, switched on and off by the administrator without editing wp-config.php. It switches itself off when the chosen time runs out (1 hour, 24 hours, 7 days).
  • No data loss: the log adds to debug.log and to the server log instead of replacing them; files are never deleted or truncated automatically (a file exceeding the chosen size, 1 to 50 MB, is closed, compressed to .zip and verified before the original is removed; at the 200 MB cap the log stops and says so); files stay when it is switched off. Only the administrator deletes them, one at a time or all together.
  • Files live in a randomly named folder inside uploads, protected by .htaccess; the log does not start if the folder is reachable from the internet. Shows the last 200 entries with a level filter and file download.
  • Security: the user enumeration block (?author=N) did not work, because WordPress’s redirect to /author// ran before the check; values such as “1a” or author[]=1 also bypassed it. The check now runs first and applies to any value.
  • Security: the PHP execution block in uploads ignored uppercase extensions (shell.PHP, executed by many hosts) and did not cover WordPress installed in a subfolder.
  • Security: on multisite the plugin settings, which write the .htaccess shared by the whole network, are now reserved to the super admin instead of every sub-site administrator.
  • Security: the reason of a ban received from the panel, written as a comment in .htaccess, can no longer contain control characters or end with “\”, which in Apache continues the line and cancelled the next blocking rule.
  • Limits: it sees errors raised after the plugin has loaded and not those suppressed with @. On uninstall the collected files stay in uploads.

1.0.14

  • Documentation: the readme points to the guides and version history on cisilino.com (csdn category). No change to the plugin’s behaviour.

1.0.13

  • Author rate limiting: the default limit (3 items in 5 minutes) also suspended an administrator who was simply working (importing or duplicating several pages in a row), not just a compromised account. The new default (150 in 5 minutes) supports real heavy use and still blocks anyone publishing hundreds at once. Values you had already customized are not touched.

1.0.12

  • Author rate limiting: it no longer counts what happens inside a WordPress installation or a temporary environment with a different table prefix (real case: Plugin Check creates a test installation with a post, a sample page and a privacy policy, and suspended the administrator using it). Auto-drafts, revisions and trashed items are no longer counted either.
  • Dashboard notice while a suspension is active: the suspended user sees the reason and the end date, administrators see the list of suspended users with the link to revoke.
  • The “Rate limiting” tab explains in practice what is counted, what is not, what being suspended means and how to get out of it.

1.0.11

  • New “Rate limiting” tab with three safeguards that can be switched on and off separately. Authors: a user who creates or publishes more than N posts/pages in window T is suspended for S seconds and the main administrator receives an email with the recent content to review. Visitors (guests): more than N comments or contact forms in window T block the IP for S seconds, only for that type of submission; the count is in a dedicated table and works even with comments disabled. Mandatory email (in the User registration tab): no user can be created without a valid email address, whatever the creation path. Each safeguard has two switches: rate limit on/off and email alert on/off (author alert on by default, visitor alert off). All N, T and S values are configurable; active suspensions are listed in the tab and can be revoked.

1.0.10

  • Fixed another blocking Plugin Check ERROR (WordPress.Security.EscapeOutput.OutputNotEscaped) that survived the previous fix: the phpcs:ignore on the multi-line echo in print_idle_script() only covered its own line, not the following ones with admin_url()/wp_create_nonce()/wp_login_url(). The call is now assigned to a variable before the single echo line, which carries the whole ignore.

1.0.9

  • Fixed a blocking ERROR of the official Plugin Check (PluginCheck.CodeAnalysis.Heredoc.NotAllowed): the admin autologout inline script used heredoc syntax, not allowed by the wordpress.org guidelines. Converted to a normal PHP string, no change in behaviour.

1.0.8

  • Fixed a fatal error (Uncaught Error: Call to undefined function get_home_path()) that could occur during a failed login attempt: Csdn_Htaccess::htaccess_path() mistakenly loaded wp-admin/includes/misc.php instead of wp-admin/includes/file.php, the file that really defines get_home_path(). In an admin context the fatal stayed invisible (the function was already available another way), but on wp-login.php it could lock access to the site with a fatal error instead of just recording the attempt.

1.0.7

  • Security: fixed a race condition in brute-force detection (Csdn_Detector::on_login_failed) that allowed bypassing the local blocking threshold by sending failed login attempts in parallel for the same IP; the counter is now an atomic upsert (INSERT … ON DUPLICATE KEY UPDATE) instead of a separate read and write.

1.0.6

  • New “Paranoic Hardening” tab: optional HTTP security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, HSTS), all off by default and applied through WordPress (send_headers), not .htaccess — they work even without mod_headers.
  • HSTS protected by an explicit guard: activation is refused if the save request does not arrive over https, to avoid sending a header that would make the site unreachable to those who receive it if the site stopped being always https.
  • Every option has an inline explanation (what it does, when it is safe, what it can break) right below its control.
  • New “Security headers check” self-test: a real request to the home page to check which headers actually arrive in the response, useful when a CDN or an upstream reverse proxy removes them in transit.
  • Paranoic Hardening: new administrator autologout on inactivity, off by default, with a configurable timeout in seconds (60-86400). Measured browser-side (mouse/keyboard/scroll, shared between tabs), not server-side, so WP Heartbeat automatic requests are not mistaken for real activity; when the timeout expires the session is really closed (wp_logout()), not just a visual redirect.

1.0.5

  • Panel reorganization: new dedicated tabs “Blocked IPs” (with client-side JavaScript filter), “Hardening / IDS” and “Test” (PHP upload block check + file integrity), separate from the General tab.

1.0.4

  • PHP execution block in uploads: .phar/.phps/.pht extensions are now covered too (before only .php/.phpN/.phtml).
  • Removed the php_admin_flag directive from the blocking rule: on PHP-FPM/CGI Apache hosting it rejects it with a 500 error on the whole site; Require all denied alone is already enough.
  • Added a self-test from the panel to check that the block really works on the site, instead of trusting only the saved configuration.

1.0.3

  • Security: fixed insufficient validation of IP addresses received from the panel, which allowed a tampered response to insert arbitrary directives into the site’s .htaccess. Only complete IP addresses and CIDRs are now accepted, both on receipt and as a last check before writing the file: no IP source can skip it any more, local overrides included.
  • Security: the connection to the panel now requires https. The sync request carries the API key, which over http was readable by anyone on the network path; http remains allowed only towards local development hosts.
  • Security: upload monitoring now recognizes .user.ini (on PHP-FPM it is equivalent to an .htaccess), SVG files, and names built with null bytes or trailing spaces to disguise an executable extension.
  • New activity log row cap, default 500 and configurable in Settings > Activity log. It limits the disk space used by the log, which also grows from unauthenticated requests (failed logins, comments, file submissions). Raising it, the page warns about the higher consumption.
  • Fixed a defect where, with the activity log on but no panel configured, retention never deleted anything: rows stayed waiting for delivery to a non-existent recipient and the table grew without limit.
  • Custom paths of the hardening rules can no longer contain quotes or control characters, which could produce an invalid .htaccess.

1.0.2

  • New “User registration” section (Settings): three policies to limit the creation of new WordPress users — no restriction, low-privilege roles only (never administrator/editor/author/shop_manager, always enforced even in case of misconfiguration), or registration excluded altogether. ON BY DEFAULT on “low-privilege roles only”: high-privilege roles are already blocked right after installation, with no configuration needed. It covers wp-admin, REST API, XML-RPC, WP-CLI and direct calls from third-party plugins/themes through the central WordPress filter used by every user creation path, plus a safety net that immediately revokes the permissions of an account created while the policy was active, whatever the entry route.

1.0.1

  • Readme cleanup: the changelog lists only the versions published on the official repository.

1.0.0

  • First public release.
  • Login defense: detection of failed attempts, local blocking of abusive IPs in .htaccess, whitelist and manual unblock from the settings page.
  • Cisilino network: optional exchange of a digest of hostile IPs with the panel and with the other sites of the network, off until the connection is configured.
  • Activity log: the site’s relevant events (logins, users, content, plugins, themes, core, options, media, uploads) are recorded locally with a configurable retention, and sent to the panel right after the event without slowing the served page.
  • Integrity check: the plugin compares the MD5 hashes of its own files with the manifest distributed in the release and reports modified, missing or unexpected files in its own folder.
  • Upload monitoring: records files entering the site even outside the media library, recognizes executable extensions including double extensions like image.php.jpg, and can reject them.
  • Optional hardening measures, all off by default.