AppSec

Last updated

Security → AppSec. The Web Application Firewall layer that inspects HTTP requests for malicious payloads.

Architecture

The CrowdSec AppSec component runs an inline filter in nginx via the appsec-block bouncer (/etc/nginx/conf.d/jabali-appsec.conf). Each request is sent to the AppSec inspector over a fast local socket; if the inspector returns “block”, nginx returns 403; otherwise the request continues.

This replaces the previously-shipped ModSecurity stack (libmodsecurity + nginx connector + OWASP CRS), which was removed entirely. The installer’s cleanup_modsecurity step purges leftover ModSecurity packages on every install to prevent broken nginx reloads.

Rule packs

Rule packs come from hub.crowdsec.net/author/crowdsecurity. The default install enables:

  • crowdsecurity/appsec-virtual-patching, the vpatch-* rules: virtual patches for known CVEs.
  • crowdsecurity/appsec-generic-rules, the generic-* rules: common LFI / RCE / XSS patterns.
  • crowdsecurity/crs, the OWASP Core Rule Set, with crowdsecurity/base-config and the WordPress exclusion plugin (crowdsecurity/crs-exclusion-plugin-wordpress).

The first two are always loaded. The Core Rule Set comes from the hub on a best-effort basis: if the download fails, the installer warns, AppSec runs the virtual patches and generic rules, and the next jabali update tries again.

The install path is flat (/etc/crowdsec/appsec-rules/). An earlier bug used a crowdsecurity/ subdirectory and re-purged-and-reinstalled 170 vpatch rules on every jabali update; that bug is fixed.

Operator controls

  • Policy mode: block (default) or log-only. Log-only is useful when adopting a new rule pack to gauge false-positive rate before enforcing.
  • Per-rule exception: exclude a specific rule for a specific URL path or for a specific user (drop the rule from the inspector configuration).
  • Per-domain exception: exclude all AppSec checks for a domain (rarely useful; documented for completeness).

Bot detection (CrowdSec 1.8)

A separate bot-detection challenge is available, off by default (per-server). Enable it under Security → AppSec. It is layered and scoped so it never silently challenges traffic on a domain the operator didn’t choose:

  • Per-server master switch (default OFF).
  • Per-domain opt-in (scope=selected) — challenge only chosen domains.
  • Per-domain opt-out — exclude a specific domain.
  • Per-path opt-out — let requests to chosen paths of a domain skip the challenge (see below).
  • Tenant self-service — a tenant can toggle it on their own domains.

Oversized request bodies are inspected up to the AppSec limit and then passed (the partial body-size action) rather than dropped, so large uploads on /api/v1/* are not blocked before the panel’s own allowlist runs.

Paths that skip the challenge

A client that cannot solve the challenge, such as an API client, a webhook or a mobile app, fails on a domain where the challenge is on. Instead of exempting the whole domain, an admin can list the paths that skip the challenge: Admin → Domains → Edit → Security → Bot detection: paths that skip the challenge, or from the command line:

jabali domain bot-exclusion add example.com /api/webhook --method POST --note "payment provider"
jabali domain bot-exclusion list example.com
jabali domain bot-exclusion delete example.com <id>
  • A path matches as a prefix of the decoded request path, without the query string: /api/ also covers /api/orders?id=1.
  • Each path applies to the domain and www.<domain>, for the chosen methods, or for every method when none are chosen.
  • Only the challenge is skipped. The WAF, rate limits and CrowdSec IP bans still apply.
  • A request whose path holds .., or still holds % after decoding, gets the challenge, so an encoded path cannot reach another part of the site through a listed one.
  • A domain can list up to 50 paths. A change takes effect in about a minute, while bot detection is on.

WAF rule exclusions do not affect the bot-detection challenge; this list does.

Inspecting blocks

The AppSec inspector logs every blocking decision with the matched rule and the request body excerpt. Surface them in Email Logs under the AppSec filter, or tail directly:

journalctl -u crowdsec-appsec -f

Update cadence

Rule packs auto-update via cscli hub update && cscli hub upgrade, run by the daily CrowdSec hub timer. The update never replaces operator exceptions; those live in panel-managed override files outside the hub-controlled tree.