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 โ†’