Exploit database

GH-9eadee138deee5707f7b427d8a4d3f51

infosecantara/cve-2025-14765-and-cve-2025-14766

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-14765

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files3

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2025-14765 & CVE-2025-14766.html

Suggested starting fileHTML · 32,454 bytes
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Chrome Vulnerability Lab: CVE-2025-14765 & CVE-2025-14766</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #0f172a;
            color: #f1f5f9;
            line-height: 1.6;
            padding: 20px;
            min-height: 100vh;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
        }

        header {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid #334155;
        }

        h1 {
            font-size: 2.5rem;
            background: linear-gradient(90deg, #f97316, #ef4444);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            margin-bottom: 10px;
        }

        .subtitle {
            font-size: 1.2rem;
            color: #94a3b8;
            margin-bottom: 20px;
        }

        .disclaimer {
            background-color: #1e293b;
            border-left: 4px solid #f59e0b;
            padding: 15px;
            border-radius: 8px;
            margin: 20px 0;
        }

        .disclaimer i {
            color: #f59e0b;
            margin-right: 10px;
        }

        .lab-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            margin-bottom: 40px;
        }

        @media (max-width: 1100px) {
            .lab-container {
                grid-template-columns: 1fr;
            }
        }

        .panel {
            background-color: #1e293b;
            border-radius: 12px;
            padding: 25px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
            border: 1px solid #334155;
        }

        .panel-title {
            font-size: 1.5rem;
            margin-bottom: 20px;
            color: #60a5fa;
            display: flex;
            align-items: center;
        }

        .panel-title i {
            margin-right: 10px;
        }

        .cve-badge {
            display: inline-block;
            background: linear-gradient(90deg, #dc2626, #b91c1c);
            color: white;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 0.9rem;
            margin-right: 10px;
            margin-bottom: 10px;
        }

        .memory-visualization {
            background-color: #0f172a;
            border-radius: 8px;
            padding: 20px;
            margin-top: 20px;
            overflow-x: auto;
        }

        .memory-row {
            display: flex;
            margin-bottom: 2px;
        }

        .memory-address {
            color: #22c55e;
            font-family: monospace;
            min-width: 80px;
            padding: 5px;
            font-size: 0.9rem;
        }

        .memory-cell {
            width: 60px;
            height: 40px;
            border: 1px solid #334155;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: monospace;
            font-size: 0.9rem;
            transition: all 0.3s;
        }

        .memory-cell.corrupted {
            background-color: #ef4444;
            color: white;
            animation: pulse 1.5s infinite;
        }

        .memory-cell.controlled {
            background-color: #f59e0b;
            color: #1e293b;
        }

        .memory-cell.freed {
            background-color: #6b7280;
            color: #d1d5db;
        }

        .memory-cell.normal {
            background-color: #374151;
            color: #f3f4f6;
        }

        .memory-cell.overflow {
            background-color: #8b5cf6;
            color: white;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }

        .memory-legend {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-top: 20px;
        }

        .legend-item {
            display: flex;
            align-items: center;
            margin-right: 15px;
        }

        .legend-color {
            width: 20px;
            height: 20px;
            margin-right: 8px;
            border-radius: 3px;
        }

        .controls {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-bottom: 25px;
        }

        button {
            padding: 12px 20px;
            border: none;
            border-radius: 8px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
        }

        button i {
            margin-right: 8px;
        }

        .btn-primary {
            background-color: #3b82f6;
            color: white;
        }

        .btn-primary:hover {
            background-color: #2563eb;
        }

        .btn-danger {
            background-color: #ef4444;
            color: white;
        }

        .btn-danger:hover {
            background-color: #dc2626;
        }

        .btn-warning {
            background-color: #f59e0b;
            color: #1e293b;
        }

        .btn-warning:hover {
            background-color: #d97706;
        }

        .btn-success {
            background-color: #10b981;
            color: white;
        }

        .btn-success:hover {
            background-color: #059669;
        }

        textarea {
            width: 100%;
            height: 150px;
            background-color: #0f172a;
            color: #f1f5f9;
            border: 1px solid #475569;
            border-radius: 8px;
            padding: 15px;
            font-family: monospace;
            font-size: 0.95rem;
            resize: vertical;
            margin-bottom: 20px;
        }

        .code-block {
            background-color: #0f172a;
            border-radius: 8px;
            padding: 20px;
            margin-top: 20px;
            overflow-x: auto;
            font-family: monospace;
            font-size: 0.95rem;
            line-height: 1.5;
        }

        .code-line {
            margin-bottom: 5px;
        }

        .code-comment {
            color: #6b7280;
        }

        .code-keyword {
            color: #f472b6;
        }

        .code-string {
            color: #22c55e;
        }

        .code-function {
            color: #60a5fa;
        }

        .vuln-description {
            margin-bottom: 25px;
            padding: 20px;
            background-color: #1e293b;
            border-radius: 8px;
            border-left: 4px solid #ef4444;
        }

        .vuln-description h3 {
            color: #fca5a5;
            margin-bottom: 10px;
        }

        .log-output {
            background-color: #0f172a;
            border-radius: 8px;
            padding: 20px;
            height: 200px;
            overflow-y: auto;
            font-family: monospace;
            font-size: 0.9rem;
            margin-top: 20px;
            border: 1px solid #475569;
        }

        .log-entry {
            margin-bottom: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid #334155;
        }

        .log-timestamp {
            color: #6b7280;
        }

        .log-info {
            color: #60a5fa;
        }

        .log-warning {
            color: #f59e0b;
        }

        .log-danger {
            color: #ef4444;
        }

        .log-success {
            color: #10b981;
        }

        .status-bar {
            display: flex;
            justify-content: space-between;
            margin-top: 20px;
            padding: 15px;
            background-color: #1e293b;
            border-radius: 8px;
            border-top: 3px solid #3b82f6;
        }

        .status-item {
            text-align: center;
        }

        .status-value {
            font-size: 1.5rem;
            font-weight: bold;
            color: #60a5fa;
        }

        .status-label {
            font-size: 0.9rem;
            color: #94a3b8;
        }

        footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 1px solid #334155;
            color: #94a3b8;
            font-size: 0.9rem;
        }

        .step-indicator {
            display: flex;
            justify-content: space-between;
            margin-bottom: 30px;
            position: relative;
        }

        .step-indicator::before {
            content: '';
            position: absolute;
            top: 15px;
            left: 0;
            right: 0;
            height: 2px;
            background-color: #334155;
            z-index: 1;
        }

        .step {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background-color: #334155;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            position: relative;
            transition: all 0.3s;
        }

        .step.active {
            background-color: #3b82f6;
            transform: scale(1.2);
        }

        .step.completed {
            background-color: #10b981;
        }

        .step-label {
            position: absolute;
            top: 35px;
            width: 120px;
            text-align: center;
            font-size: 0.85rem;
            color: #94a3b8;
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1><i class="fas fa-bug"></i> Chrome Vulnerability Interactive Lab</h1>
            <div class="subtitle">Interactive demonstration of CVE-2025-14765 & CVE-2025-14766 memory corruption vulnerabilities</div>
            
            <div class="disclaimer">
                <i class="fas fa-exclamation-triangle"></i>
                <strong>Educational Purpose Only:</strong> This lab simulates browser vulnerabilities in a safe, controlled environment for security education. No actual exploits are executed, and no real systems are harmed.
            </div>
        </header>

        <div class="step-indicator">
            <div class="step active" id="step1">
                <span>1</span>
                <div class="step-label">Allocate Memory</div>
            </div>
            <div class="step" id="step2">
                <span>2</span>
                <div class="step-label">Create Payload</div>
            </div>
            <div class="step" id="step3">
                <span>3</span>
                <div class="step-label">Trigger Vulnerability</div>
            </div>
            <div class="step" id="step4">
                <span>4</span>
                <div class="step-label">Memory Corruption</div>
            </div>
            <div class="step" id="step5">
                <span>5</span>
                <div class="step-label">Control Flow Hijack</div>
            </div>
        </div>

        <div class="lab-container">
            <!-- Left Panel: Memory Visualization -->
            <div class="panel">
                <h2 class="panel-title"><i class="fas fa-memory"></i> Memory Heap Visualization</h2>
                
                <div class="cve-badge">CVE-2025-14765: Type Confusion</div>
                <div class="cve-badge">CVE-2025-14766: Use-After-Free</div>
                
                <div class="memory-visualization" id="memoryVisualization">
                    <!-- Memory visualization will be generated by JavaScript -->
                </div>
                
                <div class="memory-legend">
                    <div class="legend-item">
                        <div class="legend-color" style="background-color: #374151;"></div>
                        <span>Normal Memory</span>
                    </div>
                    <div class="legend-item">
                        <div class="legend-color" style="background-color: #ef4444;"></div>
                        <span>Corrupted Memory</span>
                    </div>
                    <div class="legend-item">
                        <div class="legend-color" style="background-color: #f59e0b;"></div>
                        <span>Attacker Controlled</span>
                    </div>
                    <div class="legend-item">
                        <div class="legend-color" style="background-color: #6b7280;"></div>
                        <span>Freed Memory</span>
                    </div>
                    <div class="legend-item">
                        <div class="legend-color" style="background-color: #8b5cf6;"></div>
                        <span>Buffer Overflow</span>
                    </div>
                </div>
                
                <div class="status-bar">
                    <div class="status-item">
                        <div class="status-value" id="allocatedCount">0</div>
                        <div class="status-label">Allocated Objects</div>
                    </div>
                    <div class="status-item">
                        <div class="status-value" id="freedCount">0</div>
                        <div class="status-label">Freed Objects</div>
                    </div>
                    <div class="status-item">
                        <div class="status-value" id="corruptedCount">0</div>
                        <div class="status-label">Corrupted Memory Cells</div>
                    </div>
                    <div class="status-item">
                        <div class="status-value" id="vulnerabilityStatus">INACTIVE</div>
                        <div class="status-label">Vulnerability Status</div>
                    </div>
                </div>
            </div>
            
            <!-- Right Panel: Controls & Information -->
            <div class="panel">
                <h2 class="panel-title"><i class="fas fa-code"></i> Vulnerability Simulation Controls</h2>
                
                <div class="vuln-description">
                    <h3>Vulnerability Overview</h3>
                    <p>CVE-2025-14765 involves a type confusion vulnerability in Chrome's V8 JavaScript engine that allows an attacker to corrupt memory by misleading the engine about an object's type.</p>
                    <p>CVE-2025-14766 is a use-after-free vulnerability where memory is accessed after it has been freed, leading to memory corruption and potential code execution.</p>
                </div>
                
                <div class="controls">
                    <button class="btn-primary" id="allocateMemoryBtn">
                        <i class="fas fa-plus-circle"></i> Allocate Memory Object
                    </button>
                    
                    <button class="btn-warning" id="freeMemoryBtn">
                        <i class="fas fa-trash-alt"></i> Free Memory (UaF)
                    </button>
                    
                    <button class="btn-danger" id="triggerVulnBtn">
                        <i class="fas fa-bomb"></i> Trigger Vulnerability
                    </button>
                    
                    <button class="btn-success" id="resetBtn">
                        <i class="fas fa-redo-alt"></i> Reset Simulation
                    </button>
                </div>
                
                <div>
                    <label for="payloadInput"><i class="fas fa-terminal"></i> Craft Your Payload:</label>
                    <textarea id="payloadInput" placeholder="Enter your payload here... Example: {&quot;type&quot;: &quot;confused&quot;, &quot;data&quot;: &quot;A&quot;.repeat(64)}">{"type": "ArrayBuffer", "data": "A".repeat(64)}</textarea>
                </div>
                
                <button class="btn-primary" id="parsePayloadBtn" style="width: 100%; margin-bottom: 20px;">
                    <i class="fas fa-cogs"></i> Parse & Execute Payload
                </button>
                
                <div class="code-block">
                    <div class="code-line"><span class="code-comment">// Simulated vulnerable code pattern</span></div>
                    <div class="code-line"><span class="code-keyword">function</span> <span class="code-function">processBuffer</span>(buffer) {</div>
                    <div class="code-line">&nbsp;&nbsp;<span class="code-keyword">let</span> obj = <span class="code-function">deserialize</span>(buffer);</div>
                    <div class="code-line">&nbsp;&nbsp;<span class="code-comment">// Type confusion: engine thinks obj is TypeA</span></div>
                    <div class="code-line">&nbsp;&nbsp;<span class="code-keyword">let</span> processed = obj.<span class="code-function">process</span>();</div>
                    <div class="code-line">&nbsp;&nbsp;<span class="code-comment">// Use-after-free: obj was freed but reference remains</span></div>
                    <div class="code-line">&nbsp;&nbsp;<span class="code-keyword">return</span> processed;</div>
                    <div class="code-line">}</div>
                </div>
                
                <h3 class="panel-title" style="margin-top: 30px;"><i class="fas fa-clipboard-list"></i> Execution Log</h3>
                <div class="log-output" id="logOutput">
                    <div class="log-entry">
                        <span class="log-timestamp">[12:00:00]</span>
                        <span class="log-info">Lab initialized. Ready to simulate vulnerabilities.</span>
                    </div>
                    <div class="log-entry">
                        <span class="log-timestamp">[12:00:00]</span>
                        <span class="log-info">CVE-2025-14765: Type Confusion in V8 engine</span>
                    </div>
                    <div class="log-entry">
                        <span class="log-timestamp">[12:00:00]</span>
                        <span class="log-info">CVE-2025-14766: Use-After-Free in DOM component</span>
                    </div>
                </div>
            </div>
        </div>
        
        <footer>
            <p>This educational tool demonstrates browser vulnerability concepts. Always keep your browser updated to protect against real vulnerabilities.</p>
            <p>Created for Security Education | By Antara Mane</p>
        </footer>
    </div>

    <script>
        // Initialize simulation state
        const simulationState = {
            memory: [],
            allocatedObjects: [],
            freedObjects: [],
            corruptedCells: 0,
            step: 1,
            vulnerabilityTriggered: false
        };

        // DOM elements
        const memoryVisualization = document.getElementById('memoryVisualization');
        const logOutput = document.getElementById('logOutput');
        const allocatedCount = document.getElementById('allocatedCount');
        const freedCount = document.getElementById('freedCount');
        const corruptedCount = document.getElementById('corruptedCount');
        const vulnerabilityStatus = document.getElementById('vulnerabilityStatus');
        const steps = document.querySelectorAll('.step');

        // Initialize memory visualization
        function initializeMemory() {
            memoryVisualization.innerHTML = '';
            
            // Create 8 rows of memory
            for (let row = 0; row < 8; row++) {
                const memoryRow = document.createElement('div');
                memoryRow.className = 'memory-row';
                
                // Address
                const address = document.createElement('div');
                address.className = 'memory-address';
                address.textContent = `0x${(row * 8).toString(16).padStart(4, '0')}`;
                memoryRow.appendChild(address);
                
                // Create 8 memory cells per row
                for (let col = 0; col < 8; col++) {
                    const index = row * 8 + col;
                    const cell = document.createElement('div');
                    cell.className = 'memory-cell normal';
                    cell.id = `mem-${index}`;
                    cell.textContent = '00';
                    
                    // Initialize simulation state
                    simulationState.memory[index] = {
                        value: '00',
                        state: 'normal',
                        objectRef: null
                    };
                    
                    memoryRow.appendChild(cell);
                }
                
                memoryVisualization.appendChild(memoryRow);
            }
            
            updateStatus();
            logMessage('Memory visualization initialized.', 'info');
        }

        // Update status displays
        function updateStatus() {
            allocatedCount.textContent = simulationState.allocatedObjects.length;
            freedCount.textContent = simulationState.freedObjects.length;
            corruptedCount.textContent = simulationState.corruptedCells;
            
            if (simulationState.vulnerabilityTriggered) {
                vulnerabilityStatus.textContent = 'ACTIVE';
                vulnerabilityStatus.style.color = '#ef4444';
            } else {
                vulnerabilityStatus.textContent = 'INACTIVE';
                vulnerabilityStatus.style.color = '#10b981';
            }
        }

        // Add message to log
        function logMessage(message, type = 'info') {
            const timestamp = new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', second:'2-digit'});
            const logEntry = document.createElement('div');
            logEntry.className = 'log-entry';
            
            logEntry.innerHTML = `
                <span class="log-timestamp">[${timestamp}]</span>
                <span class="log-${type}">${message}</span>
            `;
            
            logOutput.appendChild(logEntry);
            logOutput.scrollTop = logOutput.scrollHeight;
        }

        // Update step indicator
        function updateStepIndicator(step) {
            simulationState.step = step;
            
            steps.forEach((stepEl, index) => {
                stepEl.classList.remove('active', 'completed');
                
                if (index + 1 < step) {
                    stepEl.classList.add('completed');
                } else if (index + 1 === step) {
                    stepEl.classList.add('active');
                }
            });
        }

        // Allocate memory object
        function allocateMemory() {
            if (simulationState.allocatedObjects.length >= 5) {
                logMessage('Maximum allocated objects reached. Free some memory first.', 'warning');
                return;
            }
            
            // Generate random memory address
            const startAddr = Math.floor(Math.random() * 40);
            const size = Math.floor(Math.random() * 3) + 2; // 2-4 cells
            
            // Check if memory is available
            let available = true;
            for (let i = startAddr; i < startAddr + size; i++) {
                if (simulationState.memory[i].state !== 'normal') {
                    available = false;
                    break;
                }
            }
            
            if (!available) {
                logMessage('Memory allocation failed: address space occupied.', 'warning');
                return;
            }
            
            // Create object
            const objId = simulationState.allocatedObjects.length + 1;
            const obj = {
                id: objId,
                startAddr: startAddr,
                size: size,
                type: ['ArrayBuffer', 'Object', 'DOMElement', 'Function'][Math.floor(Math.random() * 4)]
            };
            
            simulationState.allocatedObjects.push(obj);
            
            // Mark memory as allocated
            for (let i = startAddr; i < startAddr + size; i++) {
                simulationState.memory[i].state = 'normal';
                simulationState.memory[i].objectRef = objId;
                simulationState.memory[i].value = (i % 256).toString(16).padStart(2, '0');
                
                const cell = document.getElementById(`mem-${i}`);
                cell.className = 'memory-cell normal';
                cell.textContent = simulationState.memory[i].value;
            }
            
            logMessage(`Allocated ${obj.type} (ID: ${objId}) at address 0x${startAddr.toString(16).padStart(4, '0')}, size: ${size} cells`, 'success');
            updateStatus();
            updateStepIndicator(2);
        }

        // Free memory (simulate Use-After-Free)
        function freeMemory() {
            if (simulationState.allocatedObjects.length === 0) {
                logMessage('No allocated objects to free.', 'warning');
                return;
            }
            
            // Select a random object to free
            const objIndex = Math.floor(Math.random() * simulationState.allocatedObjects.length);
            const obj = simulationState.allocatedObjects[objIndex];
            
            // Move to freed objects list (but keep reference)
            simulationState.allocatedObjects.splice(objIndex, 1);
            simulationState.freedObjects.push(obj);
            
            // Mark memory as freed
            for (let i = obj.startAddr; i < obj.startAddr + obj.size; i++) {
                simulationState.memory[i].state = 'freed';
                
                const cell = document.getElementById(`mem-${i}`);
                cell.className = 'memory-cell freed';
                cell.textContent = 'FF';
            }
            
            logMessage(`Freed ${obj.type} (ID: ${obj.id}) - Memory marked as freed but reference may still exist (Use-After-Free)`, 'warning');
            updateStatus();
            updateStepIndicator(3);
        }

        // Trigger vulnerability
        function triggerVulnerability() {
            if (simulationState.freedObjects.length === 0) {
                logMessage('No freed objects available. Free memory first to trigger Use-After-Free.', 'warning');
                return;
            }
            
            simulationState.vulnerabilityTriggered = true;
            
            // Select a freed object
            const obj = simulationState.freedObjects[0];
            
            // Corrupt adjacent memory (buffer overflow simulation)
            const overflowStart = obj.startAddr + obj.size;
            const overflowSize = 2;
            
            for (let i = overflowStart; i < overflowStart + overflowSize; i++) {
                if (i < 64) { // Within bounds
                    simulationState.memory[i].state = 'overflow';
                    simulationState.corruptedCells++;
                    
                    const cell = document.getElementById(`mem-${i}`);
                    cell.className = 'memory-cell overflow';
                    cell.textContent = 'XX';
                }
            }
            
            // Mark the freed object as corrupted (UaF)
            for (let i = obj.startAddr; i < obj.startAddr + obj.size; i++) {
                simulationState.memory[i].state = 'corrupted';
                
                const cell = document.getElementById(`mem-${i}`);
                cell.className = 'memory-cell corrupted';
                cell.textContent = 'CC';
            }
            
            logMessage(`CVE-2025-14766 TRIGGERED: Use-After-Free vulnerability exploited on object ID: ${obj.id}`, 'danger');
            logMessage('Memory corruption detected! Adjacent memory overflow executed.', 'danger');
            updateStatus();
            updateStepIndicator(4);
        }

        // Parse and execute payload
        function parsePayload() {
            const payloadInput = document.getElementById('payloadInput');
            const payload = payloadInput.value;
            
            try {
                // Simulate parsing of payload
                const parsedPayload = JSON.parse(payload);
                
                logMessage(`Payload parsed successfully. Type: ${parsedPayload.type || 'Unknown'}`, 'info');
                
                // Simulate type confusion (CVE-2025-14765)
                if (parsedPayload.type === 'confused' || parsedPayload.data) {
                    logMessage('CVE-2025-14765 TRIGGERED: Type confusion vulnerability exploited!', 'danger');
                    logMessage('Engine misinterpreted object type, leading to memory corruption.', 'danger');
                    
                    // Corrupt some memory cells
                    for (let i = 10; i < 15; i++) {
                        if (simulationState.memory[i].state === 'normal') {
                            simulationState.memory[i].state = 'corrupted';
                            simulationState.corruptedCells++;
                            
                            const cell = document.getElementById(`mem-${i}`);
                            cell.className = 'memory-cell corrupted';
                            cell.textContent = 'TC'; // Type Confusion
                        }
                    }
                    
                    // Mark some memory as attacker controlled
                    for (let i = 20; i < 25; i++) {
                        simulationState.memory[i].state = 'controlled';
                        
                        const cell = document.getElementById(`mem-${i}`);
                        cell.className = 'memory-cell controlled';
                        cell.textContent = 'AC'; // Attacker Controlled
                    }
                    
                    updateStatus();
                    updateStepIndicator(5);
                }
                
                // Show what happens with the payload
                if (parsedPayload.data && parsedPayload.data.length > 50) {
                    logMessage(`Large payload detected (${parsedPayload.data.length} chars). Buffer overflow possible.`, 'warning');
                }
                
            } catch (e) {
                logMessage(`Payload parsing error: ${e.message}`, 'warning');
            }
        }

        // Reset simulation
        function resetSimulation() {
            simulationState.allocatedObjects = [];
            simulationState.freedObjects = [];
            simulationState.corruptedCells = 0;
            simulationState.vulnerabilityTriggered = false;
            
            logOutput.innerHTML = `
                <div class="log-entry">
                    <span class="log-timestamp">[${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', second:'2-digit'})}]</span>
                    <span class="log-info">Simulation reset. Lab reinitialized.</span>
                </div>
            `;
            
            initializeMemory();
            updateStepIndicator(1);
            logMessage('Simulation reset. Ready to start again.', 'success');
        }

        // Set up event listeners
        document.getElementById('allocateMemoryBtn').addEventListener('click', allocateMemory);
        document.getElementById('freeMemoryBtn').addEventListener('click', freeMemory);
        document.getElementById('triggerVulnBtn').addEventListener('click', triggerVulnerability);
        document.getElementById('parsePayloadBtn').addEventListener('click', parsePayload);
        document.getElementById('resetBtn').addEventListener('click', resetSimulation);

        // Initialize the simulation
        initializeMemory();
        
        // Add some initial memory allocations for demonstration
        setTimeout(() => {
            allocateMemory();
            allocateMemory();
            logMessage('Demo: Two memory objects allocated for demonstration.', 'info');
        }, 500);
    </script>
</body>
</html>