Download the PHP package ados-labs/enterprise-security-shield without Composer

On this page you can find all versions of the php package ados-labs/enterprise-security-shield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package enterprise-security-shield

Enterprise Security Shield

PHP Version PHPStan Level

Enterprise-Grade Web Application Firewall (WAF) for PHP 8.1+

A complete security solution with ML-based threat detection, bot verification, anomaly detection, and resilience patterns trained on real attack data.


Features

Core Security

Feature Description
Online Learning ML TRUE Machine Learning that learns continuously from security events
ML Threat Classifier Naive Bayes classifier pre-trained on 662 real security events
XSS Detection Multi-layer detection with HTML entity decode loop
SQL Injection Detection Pattern + behavioral analysis
Anomaly Detection Z-Score + IQR statistical analysis
Bot Verification DNS + IP range verification for 30+ bots
Honeypot System 69 trap endpoints to catch scanners
GeoIP Blocking Country-level restrictions via MaxMind
Rate Limiting 4 algorithms: sliding window, token bucket, leaky bucket, fixed

Enterprise Security (NEW)

Feature Description
Request Smuggling Detection CL.TE, TE.CL, TE.TE attack detection
WebSocket Protection CSWSH detection, origin validation, connection limits
JWT Security Validation alg:none attacks, algorithm confusion, header injection
GraphQL Protection Query depth/complexity limits, batching abuse, introspection control
DDoS Layer 7 Slowloris, RUDY, HTTP flood detection
HTTP/2 Protection CONTINUATION flood, Rapid Reset (CVE-2023-44487)
API Rate Limiting Per-endpoint, per-API-key, tier-based limits
Threat Intelligence Auto-updating feeds (FireHOL, Emerging Threats, Abuse.ch)

Resilience Patterns

Pattern Description
Circuit Breaker Fail fast when dependency is down
Retry Policy Exponential backoff with jitter
Fallback Chain Try providers in order until success
Bulkhead Limit concurrent executions

Observability

Component Format
Tracing OpenTelemetry-compatible, W3C traceparent
Metrics Prometheus text format
Health Checks JSON + HTTP status for Kubernetes

Installation

Requirements

Optional Extensions

Extension Required For
ext-redis RedisStorage (recommended for production)
ext-pdo DatabaseStorage
ext-curl Notifications, GeoIP

Optional Dependencies

Package Required For
geoip2/geoip2 GeoIP blocking (MaxMind)

Quick Start

Minimal Setup (No Redis Required)

Production Setup (Redis)

SecurityMiddleware with ML

The SecurityMiddleware automatically integrates ML-based threat detection alongside pattern-based scoring.

How ML Scoring Works:

  1. Pattern-based scoring (ThreatPatterns) runs first
  2. ML analyzer classifies the request
  3. ML score is weighted at 40% and added to pattern score
  4. If ML confidence >= 85% with BAN decision → immediate block
  5. Total score checked against threshold for auto-ban

TRUE Machine Learning (Online Learning)

The WAF includes a true online learning system that continuously improves from security events.

How It Works

  1. Initial Knowledge: Pre-trained on 662 real security events (starting weights)
  2. Continuous Learning: Every security event (ban, honeypot hit, SQLi block) trains the model
  3. Concept Drift: Decay factor (0.995) ensures older patterns lose relevance over time
  4. Persistence: Learned weights stored in Redis, survives restarts

Learning Status

Status Samples Behavior
warming_up < 50 Uses initial weights only
learning 50-500 Blends initial + learned weights
mature > 500 Primarily uses learned weights

Usage (Online Learning Classifier)

Auto-Learning Integration

The SecurityMiddleware automatically learns from every security event:


Static ML Threat Classifier

For deterministic classification (useful alongside online learning):

Training Data

Features Detected

Usage


Bot Verification

Verifies legitimate bots (Googlebot, Bingbot, etc.) via DNS reverse lookup and IP range verification.

Supported Bots

Category Bots
Search Engines Googlebot, Bingbot, YandexBot, Baiduspider, DuckDuckBot
Social Media FacebookBot, Twitterbot, LinkedInBot, Pinterest
AI Crawlers GPTBot, ClaudeBot, CCBot, PerplexityBot
SEO Tools AhrefsBot, SemrushBot, MJ12bot
Monitoring UptimeRobot, Pingdom, DatadogBot
Messaging Slackbot, TelegramBot, DiscordBot

Usage

DNS Verification

For search engine bots, the service performs reverse DNS lookup:

  1. gethostbyaddr('66.249.66.1') → crawl-66-249-66-1.googlebot.com
  2. Verify domain ends with .googlebot.com or .google.com
  3. Forward lookup confirms IP matches

Anomaly Detection

Statistical anomaly detection using Z-Score and IQR (Interquartile Range) analysis.

Metrics Analyzed

Metric Baseline Detection Method
Requests/minute 15.2 Z-Score > 3σ
404 errors/session 2.1 IQR outlier
Unique paths/session 8.7 Z-Score
Path depth 3.2 IQR outlier
Session duration 180s Anomaly if < 10s

Usage


XSS Detection

Multi-layer XSS detection with recursive HTML entity decoding.

Detection Patterns

Usage


SQL Injection Detection

Pattern-based SQLi detection with behavioral analysis.

Detection Patterns

Usage


Rate Limiting

Four algorithms for different use cases.

Algorithms

Algorithm Best For How It Works
Sliding Window API rate limits Counts requests in moving time window
Token Bucket Burst-tolerant limits Tokens refill over time, bursts allowed
Leaky Bucket Smooth rate limiting Requests "leak" at constant rate
Fixed Window Simple limits Counts per calendar minute/hour

Usage


Honeypot System

69 trap endpoints to catch scanners.

Trap Endpoints

Usage


Resilience Patterns

Circuit Breaker

Retry Policy


Storage Backends

Backend Use Case Performance Persistence
NullStorage Testing ~0.001ms No
DatabaseStorage Production (no Redis) ~1-5ms Yes
RedisStorage Production (recommended) ~0.05ms Yes

Security: Fail-Open vs Fail-Closed

By default, RedisStorage uses fail-open behavior:

For high-security applications (banking, government), implement fail-closed:


Notifications


Health Checks


Admin Panel Integration

The package includes admin panel views for WordPress-style integration.

Views Included

CSS/JS Assets (CSP A+ Compliant)

All assets use external files (no inline CSS/JS):


Testing


File Structure


Enterprise Security Features

Request Smuggling Detection

Detects HTTP Request Smuggling attacks that exploit discrepancies between front-end and back-end servers.

Detected Attack Types:


WebSocket Protection

Validates WebSocket upgrade requests and detects Cross-Site WebSocket Hijacking (CSWSH).


JWT Security Validation

Validates JWT tokens for common attack patterns. Does NOT verify signatures - use with a JWT library.

Detected Attacks:


GraphQL Protection

Protects against GraphQL-specific DoS and abuse patterns.

Detected Attacks:


DDoS Layer 7 Protection

Detects application-layer DDoS attacks. Works best with server metrics.

Detected Attacks:


HTTP/2 Protection

Detects HTTP/2 protocol-specific attacks. Requires server metrics for full detection.

Detected Attacks:


API Rate Limiting

Advanced rate limiting with per-endpoint, per-API-key, and tier-based limits.


Threat Intelligence Feeds

Auto-updating threat intelligence from public feeds.

Included Feeds:


SecurityShield Integration

All enterprise features are integrated into the main SecurityShield class:


What This WAF Actually Does

Attack Detection & Blocking

Attack Type Detection Method Real-Time Blocking
SQL Injection Tokenizer-based analysis (not just regex), detects UNION, boolean, stacked queries Yes
XSS Attacks Multi-pass HTML entity decoding, DOM analysis, event handler detection Yes
Request Smuggling CL.TE, TE.CL, TE.TE header analysis Yes
Path Traversal Pattern + normalization bypass detection Yes
Command Injection Shell metacharacter and command pattern detection Yes
GraphQL Abuse Query depth, complexity, batching limits Yes
JWT Attacks alg:none, algorithm confusion, header injection Yes

Machine Learning (Real, Not Marketing)

Component Implementation Verification
Naive Bayes Classifier src/ML/ThreatClassifier.php - 800+ lines Probabilistic classification with feature extraction
Online Learning src/ML/OnlineLearningClassifier.php Incremental training, concept drift handling
Anomaly Detection src/ML/AnomalyDetector.php Z-Score + IQR statistical analysis
Training Data 662 real security events, 188 attack patterns Pre-trained weights included

DDoS Protection (Layer 7)

Attack Detection How It Works
HTTP Flood Request rate analysis Atomic rate limiting with Redis Lua scripts
Slowloris Header receive timing Detects slow header transmission
RUDY Body receive timing Detects slow POST body attacks
HTTP/2 Rapid Reset RST_STREAM counting CVE-2023-44487 detection

Rate Limiting (4 Algorithms)

All use atomic operations (Lua scripts) to prevent race conditions:


Architecture: Where This WAF Fits

Use BOTH layers for complete protection.


Known Limitations

  1. Fail-Open Default - Allows traffic during Redis outage (configurable to fail-closed)
  2. DNS Timeout - Bot verification can block up to 30s on slow DNS (timeout configurable)
  3. No L3/L4 Protection - Cannot stop volumetric network floods (use edge WAF)
  4. No Third-Party Audit - Not penetration tested by external security firm
  5. ML Warm-Up - Online learning needs ~50 samples before improving

Transparency

This project is honest about what it does and doesn't do:


License

MIT License - see LICENSE


Credits


All versions of enterprise-security-shield with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ados-labs/enterprise-security-shield contains the following files

Loading the files please wait ...