CADRE SCRIPT v2.0
100+ Attack Types | Enterprise WAF

CloFix CADRE Script Engine

Write powerful security rules using English-like syntax. 100+ attack Types detection modules, full metadata control, built-in rate limiting, geo-blocking, and hot reload. Just save a file - no compilation, no restart.

.clofix files if/else conditions rate() function contains / matches Shared dictionaries Hot reload Domain restrictions Expiry support 100+ Attack Types

01 Introduction

CloFix CADRE Script is a lightweight, English‑like scripting language designed for WAF rules. It combines simplicity with enterprise-grade power - no compilation, no restart, no complex DSL. Just write a .clofix file and place it in the correct module folder; the CADRE engine loads it instantly into memory.

⚡ Key Capabilities
  • 100+ built‑in attack patterns - SQLi, XSS, LFI, SSRF, Log4Shell, GraphQL, NoSQLi, CMDi, and 90+ more
  • Simple conditions - if ua contains "python" { block }
  • Powerful functions - rate(ip, "60s"), matches(), contains(), starts(), ends()
  • Rich metadata - expiry dates, domain restrictions, IP/country filtering, rate limiting and logging
  • Hot reload - update rules without restarting the WAF
  • 50,000+ req/sec throughput - sub-millisecond latency

02 Why CADRE Script?

1000x Faster
Memory-first architecture - all rules pre-loaded at startup. Zero disk I/O during request processing. 0.5-2ms latency even with 10,000+ rules.
📝English-like Syntax
if path contains "/admin" { block }. Anyone on your security team can write rules within 10 minutes. No programming experience required.
🔄Hot Reload
Add, modify or delete rules while the WAF is running. Call /api/cadre/reload - changes apply immediately with zero downtime.
🔐100+ Attack Types
SQLi, XSS, LFI, RFI, SSRF, XXE, Log4Shell, GraphQL, NoSQLi, CMDi, LDAPi, SSTI, and 90+ more. Industry-leading coverage.
📊Enterprise Performance
50,000+ requests/second throughput. 5-10% CPU usage. 500MB-2GB memory. 99.97% threat detection rate.
🛡️Network-Level Blocking
iptables/nftables integration for kernel-level IP blocking. Automatic ban escalation for repeat offenders.

03 Syntax & Structure

A CADRE script file consists of optional metadata headers followed by any number of conditional blocks. If no block matches, the default allow action is applied. Comments start with #.

clofix (full structure)
# ============================================
# MODULE: SQL Injection Detection
# RULE ID: SQL-001
# VERSION: 1.0.0
# CREATOR-NAME: Security Team
# CREATOR-EMAIL: security@clofix.com
# CREATOR-ORGANIZATION: CloFix Security Inc.
# CREATOR-PARTNER-ID: PARTNER-001
# CREATOR-TIER: platinum
# CREATOR-WEBSITE: https://clofix.com
# REGISTRATION-ID: REG-2024-00123
# REGISTRATION-HASH: sha256:abc123...
# REGISTRATION-DATE: 2024-12-01T10:00:00Z
# LICENSE-TYPE: enterprise
# LICENSE-KEY: XXXX-XXXX-XXXX-XXXX
# LICENSE-VALID-FROM: 2024-12-01T10:00:00Z
# LICENSE-VALID-TO: 2025-12-01T10:00:00Z
# SEVERITY: critical
# SCORE: 95
# ANOMALY-SCORE: 85
# PARANOIA-LEVEL: 2
# CONFIDENCE: 0.98
# DESCRIPTION: Detects UNION and Boolean SQL injection
# CREATED: 2024-12-01T10:00:00Z
# UPDATED: 2024-12-15T14:30:00Z
# EXPIRES: 2025-12-01T10:00:00Z
# EXPIRY-DAYS: 365
# EXPIRY-WARNING: 30
# GRACE-PERIOD: 7
# AUTO-RENEW: true
# RENEWAL-PRICE: $99/month
# DOMAINS: example.com, api.example.com
# DOMAIN-PATTERNS: *.example.org
# EXCLUDE-DOMAINS: test.example.com
# ALLOWED-IPS: 192.168.1.0/24, 10.0.0.0/8
# BLOCKED-IPS: 1.2.3.4, 5.6.7.8
# ALLOWED-ASN: AS15169, AS16509
# ALLOWED-COUNTRIES: US, GB, CA
# BLOCKED-COUNTRIES: RU, CN, KP
# ALLOWED-CONTINENTS: NA, EU
# BLOCKED-CONTINENTS: AS, AF
# TIME-WINDOW: 09:00-17:00
# TIME-ZONE: America/New_York
# DAYS: Monday,Tuesday,Wednesday,Thursday,Friday
# DATE-RANGE-START: 2024-01-01
# DATE-RANGE-END: 2024-12-31
# BUSINESS-HOURS-ONLY: true
# RATE-LIMIT: 100
# RATE-WINDOW: 60s
# RATE-ACTION: block
# RATE-BLOCK-DURATION: 300s
# RATE-BURST: 20
# ACTION: block
# BLOCK-STATUS: 403
# BLOCK-MESSAGE: Access denied by security policy
# BLOCK-URL: https://clofix.com/blocked
# REDIRECT-URL: https://captcha.example.com
# LOG-LEVEL: INFO
# LOG-SAMPLE: 10
# ALERT-ENABLED: true
# ALERT-WEBHOOK: https://hooks.slack.com/xxx
# ALERT-EMAIL: security@clofix.com
# ALERT-SEVERITY: critical
# AUDIT-LOG: true
# REQUIRES-MODULES: core, base_sqli
# REQUIRES-ALL: false
# CONFLICTS-WITH: legacy_sqli
# PRIORITY: 1
# STAGE: main
# TAGS: owasp, sqli, critical, injection
# CATEGORY: SQL Injection
# SUB-CATEGORY: Union-based
# CVE: CVE-2024-12345
# OWASP: A03:2021-Injection
# PCI: 6.5.1
# HIPAA: 164.306
# GDPR: Article 32
# REFERENCE: https://owasp.org/sqli
# EXAMPLES: ' OR '1'='1 | UNION SELECT 1,2,3
# FIX: Use parameterized queries
# FALSE-POSITIVE-RATE: low
# TESTED-ENVIRONMENTS: nginx, apache, cloudflare
# BRAND-NAME: CloFix Security
# BRAND-LOGO: https://clofix.com/logo.png
# BRAND-URL: https://clofix.com
# BRAND-SUPPORT: support@clofix.com
# BRAND-HEADER-ENABLED: true
# BRAND-LOGO-IN-BLOCK: true
# BRAND-SUPPORT-LINK: true
# BRAND-FOOTER: © 2024 CloFix Inc.
# BRAND-BLOCK-PAGE: https://clofix.com/block.html
# SIGNATURE: MEUCIQD...
# SIGNING-KEY-ID: key-12345
# HASH-ALGORITHM: sha256
# ENCRYPTION: aes-256-gcm
# INTEGRITY-CHECK: true
# TRACK-HITS: true
# TRACK-LATENCY: true
# EXPORT-METRICS: true
# METRICS-PREFIX: waf_custom
# MIN-CADRE-VERSION: 4.0.0
# MAX-CADRE-VERSION: 5.0.0
# COMPATIBLE-WITH: cloudflare, aws_waf
# DEPRECATED-IN: 4.5.0
# REMOVED-IN: 5.0.0
# ============================================

if body matches "union.*select" {
    log attack "SQLI" "union select pattern"
    block "SQL injection detected"
}

if param.id contains "or 1=1" {
    block "Boolean SQL injection"
}

allow
                

04 Complete Metadata Reference

Core Module Information

FieldDescriptionRequiredExample
ModuleModule name/description✅ YesSQL Injection Detection
Rule IDUnique rule identifier✅ YesSQL-001
VersionSemantic version✅ Yes1.0.0, 2.1.3
SeverityThreat level✅ Yescritical, high, medium, low, info
DescriptionWhat the rule does❌ NoDetects UNION-based SQL injection
CreatedCreation timestamp❌ No2024-12-01T10:00:00Z
UpdatedLast update timestamp❌ No2024-12-15T14:30:00Z

Creator & Ownership

FieldDescriptionRequiredExample
Creator-NameCreator's full name✅ YesSecurity Team
Creator-EmailCreator's email for support❌ Nosecurity@clofix.com
Creator-OrganizationOrganization name❌ NoCloFix Security Inc.
Creator-Partner-IDPartner identification❌ NoPARTNER-001
Creator-TierCreator subscription tier❌ Nobronze, silver, gold, platinum
Creator-WebsiteCreator's website❌ Nohttps://clofix.com

Registration & Licensing

FieldDescriptionRequiredExample
Registration-IDUnique registration identifier❌ NoREG-2024-00123
Registration-HashCryptographic registration hash❌ Nosha256:abc123...
Registration-DateWhen module was registered❌ No2024-12-01T10:00:00Z
License-TypeLicense type❌ Nofree, pro, enterprise, custom
License-KeyLicense key for validation❌ NoXXXX-XXXX-XXXX-XXXX
License-Valid-FromLicense start date❌ No2024-12-01T10:00:00Z
License-Valid-ToLicense expiration❌ No2025-12-01T10:00:00Z

Expiry Configuration

FieldDescriptionBehaviorExample
ExpiresExpiration date/timeIf NOT set → NEVER expires2025-12-01T10:00:00Z
Expiry-DaysTotal validity daysDefault: 365365
Expiry-WarningDays before warningDefault: 3030
Grace-PeriodDays after expiry to allowDefault: 77
Auto-RenewAuto-renew subscriptionDefault: falsetrue
Renewal-PricePrice for renewalOptional$99/month

Domain & IP Restriction

FieldDescriptionBehaviorExample
DomainsAllowed domains (exact)If NOT set → ALL domainsexample.com, api.example.com
Domain-PatternsWildcard domain patternsOptional*.example.com
Exclude-DomainsBlocked domainsOptionaltest.example.com
Allowed-IPsAllowed IPs/CIDRsIf NOT set → ALL IPs192.168.1.0/24, 10.0.0.0/8
Blocked-IPsExclude these IPsOptional1.2.3.4, 5.6.7.8
Allowed-ASNAllowed ASN numbersOptionalAS15169, AS16509

GeoIP Restriction

FieldDescriptionBehaviorExample
Allowed-CountriesAllowed country codesIf NOT set → ALL countriesUS, GB, CA, AU
Blocked-CountriesExclude these countriesOptionalRU, CN, KP, IR
Allowed-ContinentsAllowed continentsOptionalNA, EU, AS
Blocked-ContinentsExclude these continentsOptionalSA, AF

Time Restriction

FieldDescriptionBehaviorExample
Time-WindowActive time windowIf NOT set → 24/709:00-17:00
Time-ZoneTimezone for windowDefault: UTCAmerica/New_York
DaysActive days of weekIf NOT set → ALL daysMonday,Tuesday,Wednesday
Date-Range-StartStart date for validityOptional2024-01-01
Date-Range-EndEnd date for validityOptional2024-12-31
Business-Hours-OnlyOnly during business hoursDefault: falsetrue

Rate Limiting

FieldDescriptionDefaultExample
Rate-LimitMax requests per windowNot set100
Rate-WindowTime window duration60s60s, 5m, 1h
Rate-ActionAction on limit exceededblockblock, challenge, log
Rate-Block-DurationBlock duration after limit300s300s, 10m, 1h
Rate-BurstBurst allowance020

Scoring & Confidence

FieldDescriptionDefaultExample
ScoreSeverity score (0-100)5085
Anomaly-ScoreAnomaly detection scoreNone75
Paranoia-LevelAggressiveness (1-4)None2
ConfidenceDetection confidence (0-1)None0.95

Response Action

FieldDescriptionDefaultExample
ActionWhat to do when matchedblockblock, sanitize, deceive, log, pass
Block-StatusHTTP status code403403, 404, 429
Block-MessageCustom block messageNoneAccess denied by security policy
Block-URLURL to redirect blocked requestsNonehttps://clofix.com/blocked
Redirect-URLURL for redirect actionNonehttps://captcha.example.com

Logging & Alerts

FieldDescriptionDefaultExample
Log-LevelLogging detail levelINFODEBUG, INFO, WARN, ERROR
Log-SampleSample rate for logs (1 in N)None10
Alert-EnabledEnable alertsfalsetrue
Alert-WebhookSlack/Discord webhookNonehttps://hooks.slack.com/xxx
Alert-EmailEmail for alertsCreator emailsecurity@clofix.com
Alert-SeverityMinimum severity for alertsNonecritical, high, medium, low
Audit-LogEnable audit loggingfalsetrue

Dependencies

FieldDescriptionDefaultExample
Requires-ModulesModules that must be activeNonecore, base_sqli
Requires-AllRequire ALL dependenciesfalsetrue, false
Conflicts-WithIncompatible modulesNonelegacy_sqli
PriorityExecution priority (lower=higher)51, 5, 10
StageWhen to run this moduleNonepre, main, post

Tags & Classification

FieldDescriptionExample
TagsSearchable tagsowasp, sqli, critical, injection
CategoryMain categorySQL Injection
Sub-CategorySpecific sub-categoryUnion-based
CVERelated CVECVE-2024-12345
OWASPOWASP categoryA03:2021-Injection
PCIPCI DSS requirement6.5.1
HIPAAHIPAA section164.306
GDPRGDPR articleArticle 32

Documentation

FieldDescriptionExample
ReferenceExternal documentation URLhttps://owasp.org/sqli
ExamplesAttack examples (pipe-separated)' OR '1'='1 | UNION SELECT 1,2,3
FixHow to fix the vulnerabilityUse parameterized queries
False-Positive-RateExpected FP ratelow, medium, high
Tested-EnvironmentsWhere it's testednginx, apache, cloudflare

CloFix Brand Integration

FieldDescriptionDefaultExample
Brand-NameBrand name for block pageCloFix SecurityEnterprise WAF
Brand-LogoLogo URL for block pageNonehttps://clofix.com/logo.png
Brand-URLBrand website URLhttps://clofix.comhttps://security.com
Brand-SupportSupport contact infoNonesupport@clofix.com
Brand-Header-EnabledAdd X-CloFix-* headerstruetrue, false
Brand-Logo-In-BlockShow logo on block pagetruetrue, false
Brand-Support-LinkShow support linktruetrue, false
Brand-FooterCustom footer textNone© 2024 CloFix Inc.
Brand-Block-PageCustom block page URLNonehttps://custom.com/block.html

Security & Validation

FieldDescriptionExample
SignatureDigital signature of moduleMEUCIQD...
Signing-Key-IDKey identifier for verificationkey-12345
Hash-AlgorithmHash algorithm for integritysha256, sha512
EncryptionEncryption methodaes-256-gcm
Integrity-CheckVerify module integritytrue, false

Analytics & Metrics

FieldDescriptionDefaultExample
Track-HitsCount rule matchesfalsetrue
Track-LatencyMeasure processing timefalsetrue
Export-MetricsExport to Prometheusfalsetrue
Metrics-PrefixCustom metrics prefixcadrewaf_custom

Compatibility

FieldDescriptionExample
Min-CADRE-VersionMinimum engine version4.0.0
Max-CADRE-VersionMaximum engine version5.0.0
Compatible-WithCompatible platformscloudflare, aws_waf
Deprecated-InDeprecation version4.5.0
Removed-InRemoval version5.0.0

05 Variables

VariableDescriptionExample
ipClient IP addressif ip == "1.2.3.4"
methodHTTP methodif method == "POST"
pathURL pathif path starts "/admin"
uaUser-Agent headerif ua contains "python"
bodyRequest bodyif body matches "union.*select"
countryCountry code (GeoIP)if country == "RU"
is_torTor exit node flagif is_tor
scoreThreat score (0-100)if score > 80
param.nameQuery parameterif param.id == "1"
form.namePOST form fieldif form.username == "admin"

06 Built‑in Functions

FunctionDescriptionExample
rate(key, window)Returns request count in windowrate(ip, "60s")
contains(str, sub)String containsif ua contains "python"
matches(str, regex)Regex matchif body matches "union.*select"
starts(str, prefix)Prefix checkif path starts "/admin"
ends(str, suffix)Suffix checkif file ends ".php"
length(str)String lengthif length(body) > 1000
log_attack(type, payload)Structured attack loglog attack "SQLI" "union select"

07 Actions

ActionDescriptionExample
blockBlock requestblock or block "Custom message"
allowAllow requestallow
logLog messagelog "Request processed"
addAdd response headeradd "X-Frame-Options: DENY"
removeRemove response headerremove "Server"
redirectRedirect requestredirect "https://example.com/login"

08 Attack Types (100+ Modules)

🔻 Injection Attacks (10 types)

💉SQL Injection
UNION-based, Boolean blind, Time-based, Error-based, Stacked queries
🍃NoSQL Injection
$ne, $gt, $regex, $where operators, JavaScript injection
📋LDAP Injection
LDAP metacharacters, filter manipulation, auth bypass
⌨️Command Injection
rm -rf, curl/wget, reverse shells, command chaining
🗺️XPath Injection
OR injection patterns, XML query manipulation
📝Code Injection
eval(), assert(), create_function() injection
🎨SSTI
Jinja2, Twig, Freemarker, Velocity template injection
🔧EL Injection
Expression Language injection, ClassLoader access

⚠️ XSS Attacks (8 types)

🔄Reflected XSS
Script tags, event handlers, JavaScript protocol
💾Stored XSS
IMG onerror, SVG onload, IFRAME injection
🌳DOM-based XSS
DOM manipulation, Cookie/location access
🎯Blind XSS
Image src callbacks, Fetch API, BeEF hooks
📄HTML Injection
IFRAME, OBJECT, EMBED injection
📜JS Injection
Alert functions, setTimeout/setInterval abuse

📁 File-Based Attacks (7 types)

📂LFI
Local File Inclusion, /etc/passwd, PHP wrappers
🌐RFI
Remote File Inclusion, HTTP/HTTPS/FTP includes
🔄Path Traversal
../, ..\, URL-encoded traversal, double encoding
📤File Upload
Dangerous extensions, double extensions, MIME spoofing
🐚WebShell
c99, r57, b374k, China Chopper, PHP webshells

🖥️ Server-Side Attacks (6 types)

🌐SSRF
Localhost, metadata endpoints, internal IPs
📄XXE
XML External Entity, DOCTYPE, parameter entities
🔧SSI
Server-Side Includes directives
📦Java Deserialization
Magic bytes detection, ysoserial payloads
📦PHP Deserialization
Object injection patterns
📦Python Deserialization
Pickle/YAML injection

🔑 Auth & Session Attacks (5 types)

🔐Session Fixation
Session cookie patterns, fixation attacks
🔄CSRF
Missing headers detection, token validation
🔑JWT Attack
None algorithm, signature bypass, alg confusion
🍪Cookie Tampering
Admin cookie patterns, manipulation
🔗OAuth Attack
Redirect URI manipulation, code injection

🔌 API Attacks (6 types)

📊GraphQL Introspection
__schema, __type queries
📏GraphQL Depth
Deep nested queries, DoS
📦GraphQL Batching
Alias bombing, batch attacks
🔓API Auth Bypass
URL override, method override
📝API Mass Assignment
Admin field injection
⏱️API Rate Limit Bypass
IP spoofing detection

🐌 DoS/Protocol Attacks (6 types)

🐌Slowloris
Incomplete headers, slow read attacks
🔁ReDoS
Nested quantifiers, evil regex patterns
💣XML Bomb
Billion laughs, entity expansion
📦JSON Bomb
Deep nesting attacks
📨HTTP Smuggling
CL.TE, TE.CL, duplicate headers
🏠Host Header Injection
Duplicate host, CRLF injection

🔍 Scanner Detection (6 types)

🗺️SQLMap
SQLMap User-Agent and signatures
🔍Nmap
Nmap scripting engine detection
📋Nikto
Nikto scanner detection
🔧Burp Suite
Burp User-Agent and headers
📁DirBuster
Directory brute-forcing tools
🖥️WPScan
WordPress scanner detection

🐞 Modern Vulnerabilities (4 types)

📝Log4Shell
JNDI injection patterns, obfuscated bypasses
🍃Spring4Shell
ClassLoader access patterns
💥ShellShock
Function definition patterns
⚙️Struts2
OGNL injection patterns

☁️ Cloud Attacks (4 types)

☁️AWS Metadata
169.254.169.254, /latest/meta-data/
☁️GCP Metadata
metadata.google.internal
☁️Azure Metadata
169.254.169.254/metadata
📦S3 Bucket
Bucket enumeration, access patterns

📜 Script Blocking (50+ Languages)

🐹Go
go-http-client, os.Exec, exec.Command, net.Dial, reverse shells
🐍Python
python-requests, python -c, exec(), eval(), subprocess, os.system, pickle, cpickle, __import__, reverse shells
📘Node.js
node-fetch, axios, superagent, child_process.exec, require('net'), vm.runInNewContext, reverse shells
🐘PHP
system(), exec(), shell_exec(), passthru(), popen(), proc_open(), eval(), assert(), create_function(), webshells (c99, r57, b374k)
💎Ruby
system(), exec(), IO.popen, TCPSocket, UNIXSocket, Kernel.exec, reverse shells
🐪Perl
system(), exec(), backticks (`), qx//, open(), IO::Socket, reverse shells
🐚Bash
bash -c, sh -c, zsh -c, dash -c, reverse shells (bash -i, nc -e), command substitution ($(), ``), pipe to sh
🪟PowerShell
Invoke-Expression, IEX, -EncodedCommand, -e, DownloadFile, Invoke-WebRequest, wget, Net.WebClient, AMSI bypass patterns
Java
Runtime.exec(), ProcessBuilder, JNDI injection (Log4Shell), Java deserialization, JDBC connection strings
📜JavaScript
eval(), Function(), setTimeout(), setInterval(), document.write(), location.replace(), fetch()
🔧Lua
os.execute(), io.popen(), loadfile(), dofile(), require() with dangerous modules
🦀Rust
std::process::Command, std::net::TcpStream, reverse shell patterns, unsafe code execution
🔷C#
Process.Start(), WebClient.DownloadString(), Assembly.Load(), reflection invocation, PowerShell assembly loading
📊R
system(), shell(), source(), eval(), parse(), unserialize()
🔢Julia
run(), eval(), include(), exec()
🍎Swift
Process(), shell() from Foundation, NSTask
🎯Kotlin
Runtime.exec(), ProcessBuilder, eval() in scripting mode
🔥Scala
scala.sys.process, Runtime.exec(), ProcessBuilder
✏️Groovy
execute(), Runtime.exec(), GroovyShell.evaluate()
📝Tcl
exec(), open |, source, eval
💧Elixir
System.cmd(), :os.cmd(), eval()
📞Erlang
os:cmd(), rpc:call()
λHaskell
System.Process.callCommand, System.Cmd.system, unsafePerformIO
🔗Clojure
(clojure.java.shell/sh), (eval), (load-string), Runtime.exec() interop
🎯Dart
Process.run(), Process.start(), Isolate.spawnUri()
🍏Objective-C
system(), popen(), NSTask
📜VBScript
CreateObject("WScript.Shell").Run, Execute, Eval
📊MATLAB
system(), eval(), run(), load() with malicious .mat
🗄️SQL Scripts
xp_cmdshell, sp_configure, exec master..xp_cmdshell, MySQL INTO OUTFILE, PostgreSQL COPY PROGRAM
📘TypeScript
child_process.exec, eval(), fetch(), axios (compiled to JS patterns)
Zig
std.os.system, std.ChildProcess, execve patterns
🔷Nim
exec(), gorge(), staticExec(), osproc.startProcess()
💎Crystal
system(), Process.run(), eval()
🔷F#
System.Diagnostics.Process.Start, System.IO.File.WriteAllText (webshells)
🐫OCaml
Sys.command(), Unix.open_process, eval()
🎨Racket
system(), process, eval, dynamic-require
🌀Common Lisp
run-program, shell, eval, load
🔢Fortran
CALL SYSTEM(), EXECUTE_COMMAND_LINE()
💼COBOL
CALL 'SYSTEM', DISPLAY UPON CONSOLE (command injection)
📦Delphi
ShellExecute(), WinExec(), CreateProcess()
🔷Ada
Ada.Command_Line, System.Address_Image (information disclosure)
📜Prolog
shell(), open/3 with pipe, exec/1
📦Smalltalk
system: 'command', perform: #value:
λScheme
system, open-input-pipe, eval
📊VBA
Shell(), CreateObject("WScript.Shell").Run, Application.Run
🤖AutoIt
Run(), ShellExecute(), RunAs()
⌨️AutoHotkey
Run, RunWait, ComObjCreate("WScript.Shell")
🪟Windows Batch
cmd.exe /c, powershell.exe -c, certutil -urlcache, regsvr32.exe
⬇️cURL
curl command, wget, aria2, axel downloaders, data exfiltration patterns
📁FTP Clients
ftp, sftp, lftp commands with credential exfiltration
🔐SSH Clients
ssh commands, scp, rsync for tunneling or exfiltration
🗄️Database Clients
mysql, psql, sqlcmd, mssql-cli for data extraction
Redis CLI
redis-cli with FLUSHALL, CONFIG SET, EVAL lua scripts
🍃MongoDB Client
mongo, mongosh with db.adminCommand(), eval()

09 Complete Examples

Example: SQL Injection Protection with Full Metadata

clofix
# ============================================
# MODULE: SQL Injection Detection
# RULE ID: SQL-001
# VERSION: 2.0.0
# AUTHOR: Security Team
# SEVERITY: critical
# DESCRIPTION: Detects UNION, Boolean, Time-based SQL injection
# CREATED: 2024-12-01T10:00:00Z
# EXPIRES: 2025-12-01T10:00:00Z
# DOMAINS: example.com, api.example.com
# ALLOWED-IPS: 192.168.1.0/24
# BLOCKED-COUNTRIES: RU, CN, KP
# RATE-LIMIT: 100
# RATE-WINDOW: 60s
# TAGS: owasp, sqli, critical
# OWASP: A03:2021-Injection
# ============================================

if body matches "union.*select|or.*=.*=|sleep\\(\\d+\\)" {
    log attack "SQLI" "injection pattern"
    block "SQL injection detected"
}

if param.id contains "' or '1'='1" {
    block "Boolean SQL injection"
}

let req = rate(ip, "60s")
if req > 100 {
    block "Rate limit exceeded"
}

allow

Example: Complete Security Profile

clofix
# ============================================
# MODULE: Complete Security Profile
# RULE ID: ALL-001
# VERSION: 2.0.0
# AUTHOR: Security Team
# SEVERITY: mixed
# ============================================

# SQL Injection
if body matches "union.*select|or.*=.*=" {
    log attack "SQLI" "injection"
    block "SQL injection"
}

# XSS Protection
if body contains " 60 { block "Rate limit" }

# Geo Blocking
if country == "RU" { block "Country blocked" }

# Login Protection
if path == "/login" {
    let attempts = rate("login:" + ip, "5m")
    if attempts > 5 { block "Too many login attempts" }
}

# Response Hardening
add "X-Frame-Options: DENY"
add "X-Content-Type-Options: nosniff"
remove "Server"

allow

10 Deployment

bash
# Add a new rule
sudo tee /etc/clofix/cadre_modules/sqli/001-sql-injection.clofix << 'EOF'
if body matches "union.*select" { block "SQL injection" }
allow
EOF

# Reload engine instantly
curl -X POST http://localhost:8080/api/cadre/reload

# Check statistics
curl http://localhost:8080/api/cadre/stats
📁 Directory Structure
/etc/clofix/cadre_modules/
├── sqli/ └── 001-sql-injection.clofix
├── xss/  └── 001-xss-protection.clofix
├── bot/  └── 001-bot-detection.clofix
└── geo/  └── 001-country-block.clofix

11 Best Practices

  • Order matters - rules execute alphabetically; use numeric prefixes like 01_, 02_ to control priority.
  • Use rate limiting - always wrap login/OTP endpoints with rate() to prevent brute‑force.
  • Log attacks - use log attack for structured logging and SIEM integration.
  • Set expiry dates - for temporary rules, add Expires: YYYY-MM-DDTHH:MM:SSZ to auto‑disable them.
  • Restrict domains - use Domains: example.com to keep rules scoped to specific applications.
  • Test before deploying - use curl to simulate attacks and verify rule behaviour.
Need Help? For CloFix WAF support or CADRE Script questions, visit our Support page or contact us.

12 Contribute to CADRE

🤝 Contribute Rules
Help make CADRE the most comprehensive WAF rule engine. Share your security rules, attack patterns, and detection modules with the community.
📧 Email: support@clofix.com
🐙 GitHub: github.com/clofix19/clofix-cadre-engine
🌟 Get Involved
Ways to contribute:
  • ✓ Submit new attack detection rules
  • ✓ Report false positives/negatives
  • ✓ Improve documentation
  • ✓ Share deployment examples
  • ✓ Create language packs
⭐ Star us on GitHub
Support the project by giving us a star!

📢 All contributions are welcome! Whether you're a security researcher, developer, or just passionate about web security.

GitHub Repository → Email Us →