cbcvebase.
CVE-2007-4776
published 2007-09-10

CVE-2007-4776: Buffer overflow in Microsoft Visual Basic 6.0 and Enterprise Edition 6.0 SP6 allows user-assisted remote attackers to execute arbitrary code via a Visual Basic…

PriorityP352critical9.3CVSS 2.0
AVNACMAuNCCICAC
EXPLOIT
EPSS
48.96%
98.7th percentile
Buffer overflow in Microsoft Visual Basic 6.0 and Enterprise Edition 6.0 SP6 allows user-assisted remote attackers to execute arbitrary code via a Visual Basic project (vbp) file containing a long Reference line, related to VBP_Open and OLE. NOTE: there are limited usage scenarios under which this would be a vulnerability.

Affected

1 ranges
VendorProductVersion rangeFixed in
microsoftvisual_basic

Detection & IOCsextracted from sources · hover to see the quote

filenamemsf.vbp
commandReference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation
path..\..\..\..\WINDOWS\system32\stdole2.tlb
other0x0fabd271
other0x7ffddfb4
other0x37178B60
bytes
\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x4f\x49\x49\x49\x49\x49\x49\x51\x5a\x56\x54\x58\x36\x33\x30\x56\x58\x34\x41\x30\x42\x36
  • Trigger is a .VBP file with an abnormally long 'Reference=' line (overflow occurs at ~494-496 bytes into the Reference value); monitor file-open events for Visual Basic 6.0 (VBP_Open) processing oversized Reference lines.
  • The malicious VBP file always contains a Reference line pointing to stdole2.tlb via a deep relative path traversal (../../../../WINNT/System32/stdole2.tlb or similar) followed by the overflow payload; flag VBP files whose Reference= value exceeds ~494 characters.
  • The return address used in the Metasploit module targets a gadget inside VBSCC.DLL (call ESP, 0x37178B60); presence of this address in a crash context or memory scan indicates exploitation of this CVE.
  • The Koshi/original PoC uses a 'jmp ebp' gadget from ntdll.dll at 0x7C923DA3 (Windows XP SP2 English); this return address in an exception context is a strong indicator of exploitation.
  • Bad characters for payload are null byte, LF, CR, and space (\x00\x0a\x0d\x20); shellcode in exploit files will avoid these bytes — use this constraint when writing YARA rules for payload detection inside VBP files.
  • Payload space is constrained to 650 bytes with a stack adjustment of -3500; look for large blocks of alphanumeric-encoded shellcode immediately following the Reference= overflow padding in a VBP file.
  • ·Return addresses are OS/SP/locale-specific; the Metasploit module only targets Windows XP SP2 English, while the Perl PoC lists multiple ntdll.dll gadget addresses for XP SP1/SP2, Win2000, and Win2003 in various locales — detections relying on specific return addresses will miss other configurations.
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.