php-next RuntimeBlobV2

Technical Architecture & Security Model
Version 2.0 • December 2025

Abstract

php-next RuntimeBlobV2 represents a paradigm shift in PHP source code protection. Unlike traditional obfuscators that merely obscure code, RuntimeBlobV2 employs a multi-layered defense architecture combining authenticated encryption, per-build virtual machine randomization, and hardware-bound execution. This paper presents the technical architecture, cryptographic foundations, threat model, and performance characteristics of RuntimeBlobV2, demonstrating how it achieves a 98/100 security score while maintaining ultra-compact 500-byte output sizes.

1. Introduction

1.1 The Problem with Traditional PHP Protection

PHP source code protection has historically relied on simple obfuscation techniques that provide minimal security against determined attackers. Traditional solutions suffer from several critical weaknesses:

1.2 The php-next Approach

php-next RuntimeBlobV2 addresses these fundamental issues through three core innovations:

  1. Per-Build Randomization: Every encoded file receives unique VM opcodes and encryption keys
  2. Self-Decrypting Architecture: Decoder logic is encrypted within each blob, not exposed in loaders
  3. Ultra-Compact Design: Fixed 500-byte output regardless of source complexity
Key Insight: By isolating decoding logic inside each encrypted blob, cracking one build provides no information about other builds. This is fundamentally different from traditional protection where a single decoder compromise affects all protected files.

2. System Architecture

2.1 High-Level Overview

RuntimeBlobV2 consists of four primary components:

  1. Encoder: Compiles PHP source to IR, optimizes, and generates encrypted blob
  2. Loader (Open Source): Minimal PHP wrapper that bootstraps execution
  3. Encrypted Blob: Contains VM runtime, bytecode, and decoder logic
  4. License Server: Validates hardware binding and provides decryption tokens

2.2 Blob Structure (High-Level)

Each RuntimeBlobV2 blob consists of multiple encrypted layers. Actual blob size varies based on source complexity and compression efficiency:

Layer Purpose Size (bytes)
Header Version, metadata, MAC ~64
Layer 1 Encrypted decoder stub ~150-200
Layer 2 VM runtime ~180-250
Layer 3 Bytecode + constants Variable (compressed)
Total (typical) 500 bytes - 4 KB
Size Note: Simple scripts may compress to ~500 bytes. Complex applications with many constants typically range 1-4 KB. This is still 10-50× smaller than traditional encoders (which produce 5-10× larger output).
Note: Exact layer boundaries and encryption chaining are proprietary. The above represents functional components, not binary layout.

2.3 Execution Flow

1. Loader requests token from License Server
   ↓ (validates hardware fingerprint)
   
2. Server returns time-limited JWT token
   ↓
   
3. Loader passes token to blob
   ↓
   
4. Blob self-decrypts Layer 1 (decoder stub)
   ↓
   
5. Decoder stub decrypts Layer 2 (VM runtime)
   ↓
   
6. VM runtime decrypts Layer 3 (bytecode)
   ↓
   
7. VM executes bytecode
   ↓
   
8. Output returned to PHP

3. Cryptographic Foundation

3.1 Design Principles

RuntimeBlobV2's cryptographic design follows modern best practices:

3.2 ChaCha20-Poly1305 Selection

We chose ChaCha20-Poly1305 over AES-GCM for several reasons:

Criterion ChaCha20-Poly1305 AES-GCM
Software Performance ✓ Excellent Moderate (without AES-NI)
Timing Attacks ✓ Resistant Vulnerable (without hardware)
IV Reuse Impact Critical Catastrophic
Side-Channel Resistance ✓ Strong Moderate

3.3 Key Management

RuntimeBlobV2 employs a hierarchical key derivation scheme:

Security Property: Compromise of one layer key does not expose other layers. Each layer requires independent cryptanalysis.

3.4 Hardware Binding

Hardware fingerprinting combines multiple system identifiers:

The fingerprint is hashed using BLAKE2b and incorporated into key derivation, ensuring blobs only execute on authorized hardware.

4. Virtual Machine Design

4.1 Architecture Philosophy

The RuntimeBlobV2 VM is designed for three objectives:

  1. Obfuscation: Hide original PHP control flow and logic
  2. Efficiency: Minimal overhead compared to native PHP
  3. Uniqueness: Per-build randomization prevents pattern recognition

4.2 Instruction Set Randomization

Each build generates a unique instruction set through:

Impact: An attacker who reverse-engineers one build's VM gains no knowledge applicable to other builds. Each must be analyzed independently.

4.3 Bytecode Compilation

PHP source undergoes multi-stage compilation:

PHP Source
   ↓ (parse)
Abstract Syntax Tree (AST)
   ↓ (lower)
Intermediate Representation (IR)
   ↓ (optimize)
Optimized IR
   ↓ (codegen)
VM Bytecode
   ↓ (compress)
Compressed Bytecode

4.4 Runtime Optimization

The VM employs several performance optimizations:

5. Security Model

5.1 Defense-in-Depth Strategy

RuntimeBlobV2 implements multiple defensive layers:

Layer Mechanism Purpose
Layer 1 AEAD Encryption Confidentiality + Integrity
Layer 2 MAC Verification Tamper Detection
Layer 3 Per-Build Randomization Pattern Obfuscation
Layer 4 Hardware Binding Unauthorized Execution Prevention
Layer 5 Server Validation License Enforcement

5.2 Anti-Tamper Mechanisms

Multiple tamper detection techniques are employed:

5.3 Poison Mode

When tampering is detected, RuntimeBlobV2 enters "poison mode":

Design Rationale: Silent failure with incorrect output is more effective than obvious crashes, as it prevents attackers from identifying protection boundaries.
Development Note: During development, anti-tamper checks may produce false positives in debugging environments (IDEs, sandboxes). We recommend testing in production-like environments and using debug builds with relaxed checks during development.

6. Threat Model & Attack Resistance

6.1 Attacker Capabilities & Assumptions

We assume attackers have:

Out of Scope (Not Protected Against)

RuntimeBlobV2 does NOT provide protection against:

Important: No software-only protection is absolute. RuntimeBlobV2 significantly raises the bar for reverse engineering but cannot prevent all attacks, especially those with kernel-level or hardware access. Threat model assumes userspace-level adversaries typical in commercial software piracy scenarios.

6.2 Attack Vectors & Defenses

Attack Vector Difficulty Defense
Static Analysis High Encryption + Compression
Dynamic Analysis Very High Anti-Debug + Timing Checks
Memory Dumping Very High Runtime Encryption + Obfuscation
Known Plaintext Infeasible Per-Build Keys + AEAD
Brute Force Infeasible 256-bit Keys + Hardware Binding
Pattern Recognition Infeasible Per-Build VM Randomization

6.3 Security Score Breakdown

Internal security assessment (December 2025), validated against OWASP secure coding guidelines and common reverse engineering attack vectors:

Audit Scope: This assessment covers userspace-level protection against reverse engineering and tampering. It assumes attackers have standard debugging tools but not kernel-level access or hardware exploits. External third-party audit scheduled for Q2 2025.
Category Score Details
Encryption Strength 100/100 ChaCha20-Poly1305 AEAD
Tamper Detection 100/100 MAC + Self-Integrity
Anti-Debug 96/100 Multi-technique Detection
Hardware Binding 96/100 Multi-metric Fingerprint
Replay Protection 95/100 Time-Limited Tokens
Overall 98/100 Industry Leading

6.4 Time-to-Crack Analysis

Estimated time for different attacker profiles:

Key Insight: Even successful attacks only compromise individual builds, not the entire protection system. The time investment scales linearly with number of files.

7. Performance Analysis

7.1 Encoding Performance

Source Size Encode Time Output Size
10 KB 0.3s 500 bytes
100 KB 0.8s 500 bytes
1 MB 2.1s 500 bytes

7.2 Runtime Performance

Benchmark results (average across 1000 runs):

7.3 Size Comparison

Encoder Input Output Ratio
ionCube 50 KB ~250 KB 5.0× larger
Zend Guard 50 KB ~280 KB 5.6× larger
SourceGuardian 50 KB ~180 KB 3.6× larger
php-next (simple) 5 KB ~800 bytes 0.16×
php-next (complex) 50 KB ~2.5 KB 0.05×
Note: php-next achieves compact output through aggressive compression, constant pooling, and IR optimization. Simple scripts with minimal constants compress more effectively. Complex applications with large constant tables may reach 3-4 KB but still remain 10-50× smaller than traditional encoders.

8. License Editions & Security Tiers

8.1 Edition Overview

php-next RuntimeBlobV2 is available in four editions, each designed for different security requirements and deployment scenarios:

Edition Security Score Use Case Deployment
TRIAL 95/100 7-day evaluation, full PRO features Shared hosting, VPS, Cloud
PRO 97/100 Commercial applications, SaaS backends Shared hosting, VPS, Cloud
ULTRA 98/100 High-value business logic, premium plugins VPS, Cloud (native loader required)
ULTRA V1 99/100 Regulated industries, zero-knowledge requirements VPS, Cloud (native loader required)

8.2 Feature Comparison

The following table details the security features available in each edition:

Feature TRIAL PRO ULTRA ULTRA V1
VM-Based Execution
Per-Build Randomization
Multi-Layer Encryption (ChaCha20-Poly1305) Basic
Multi-Stream Bytecode
Polymorphic Opcodes Basic Advanced
Anti-Debug Detection Basic Advanced (multi-technique)
Anti-Tamper (Code Integrity) Basic Advanced (self-healing)
Hardware Binding
Domain Lock
License Binding
Decoy VM (Fake Mode)
Native Loader (.so/.dll)
Shared Hosting Compatible

8.3 ULTRA V1: Zero-Knowledge Architecture

ULTRA V1 represents the pinnacle of php-next's security architecture, implementing several advanced techniques:

Use Case: ULTRA V1 is designed for applications requiring the highest level of protection, such as financial software, healthcare systems, government applications, and proprietary algorithms in competitive markets.

8.4 Loader Architecture

php-next uses two distinct loader implementations:

Native Loader (PRO/ULTRA/ULTRA_V1)

The native loader is a compiled PHP extension (php_next_loader.so on Linux, php_next_loader.dll on Windows) that provides:

The native loader exports two PHP functions:

// Execute a protected blob
php_next_run(string $blobPathOrData, array $options = []): void

// Get loader information
php_next_info(): array
// Returns: ['version' => '1.0-sec13', 'editions' => ['PRO', 'ULTRA', 'ULTRA_V1'], 'build_id' => '...']

DEV Loader (Development/OSS)

The DEV loader is a pure PHP implementation designed for:

Security Note: The DEV loader explicitly refuses to execute PRO/ULTRA/ULTRA_V1 blobs. Attempting to run a protected blob with the DEV loader will result in a clear error message. This is by design to prevent security vulnerabilities.

DEV loader API:

<?php
require 'php-next-loader.php';

// Run a DEV/OSS blob
PhpNextDevLoader::run('blob.enc.php');

// Attempting to run PRO/ULTRA/ULTRA_V1 will throw:
// PhpNextDevLoaderException: "Protected editions require native loader"
?>

9. Industry Comparison

8.1 Feature Matrix

Feature ionCube Zend Source php-next
Encryption Legacy Legacy AES-256 ✓ ChaCha20-Poly1305
Per-Build VM ✓ Unique
Hardware Binding Basic Basic ✓ Server-Validated
Compact Output ✓ 500 bytes
Open Source Core ✓ Yes
Security Score 75/100 80/100 78/100 98/100

8.2 Cost Analysis

Solution Cost (1 project) Model
ionCube $299/year Subscription
Zend Guard $449/year Subscription
SourceGuardian $259/year Subscription
php-next PRO €99 one-time Perpetual
php-next ULTRA €299 one-time Perpetual

10. Use Cases

9.1 Commercial PHP Applications

SaaS providers and commercial PHP applications benefit from:

9.2 WordPress Plugins & Themes

Premium plugin/theme developers gain:

9.3 Custom Development Projects

Agencies protecting client deliverables achieve:

9.4 Educational & Research

Academic institutions use RuntimeBlobV2 for:

11. Real-World Examples

10.1 Example 1: Simple API Endpoint

// Original PHP: 2.3 KB
<?php
function getUserData($userId) {
    $db = new PDO('mysql:host=localhost');
    $stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
    $stmt->execute([$userId]);
    return $stmt->fetch(PDO::FETCH_ASSOC);
}

echo json_encode(getUserData($_GET['id']));
?>

// Encoded blob: 687 bytes
// Compile time: 0.2s
// Runtime overhead: ~3μs

10.2 Example 2: WordPress Plugin Core

// Original PHP: 45 KB (plugin logic)
// Classes: 5
// Functions: 23
// Constants: 17

// Encoded blob: 2,840 bytes (2.8 KB)
// Compile time: 0.7s
// Runtime overhead: ~8μs
// Size reduction: 94%

10.3 Example 3: E-commerce Checkout Flow

// Original PHP: 127 KB
// Files: 12
// Classes: 18
// Database queries: 34

// Encoded blob: 4,196 bytes (4.1 KB)
// Compile time: 1.8s
// Runtime overhead: ~12μs
// Size reduction: 97%

10.4 Key Observations

12. Security Limitations & Assumptions

11.1 What RuntimeBlobV2 Protects

✓ Protected Against:

11.2 Known Limitations

✗ NOT Protected Against:

11.3 Recommended Deployment Practices

Realistic Expectations: RuntimeBlobV2 significantly raises the difficulty and cost of reverse engineering, making it economically unviable for most attackers. However, no software-only protection is absolute. Determined attackers with sufficient resources, time, and expertise may eventually succeed. The goal is to make the cost of attack exceed the value gained.

13. Conclusion

13.1 Key Achievements

RuntimeBlobV2 represents a fundamental advancement in PHP source code protection:

13.2 Future Directions

Ongoing research focuses on:

13.3 Try php-next

Experience RuntimeBlobV2 protection:

⚡ Try Online Demo 🚀 Start 7-Day PRO Trial

About This Document

Version: 2.0
Date: December 2025
Lead Developer: Nico Vermaeck
Authors: php-next Security Team
Contact: security@php-next.com
License: © 2025 php-next. All rights reserved.

📥 Download PDF