VBDec Bug


Author: David Zimmer
Date: 12.01.22 - 5:23pm



So here is a little oddity I noticed the other day and results in a bug in vbdec for native executables. (PCode is fine).

The ProcNames array, MethodLinks, and PrivObj.FuncTypInf arrays are parallel arrays. Well at least they are for PCode.

native compile:
--------------------------------
source:
	Public Function a()
	Private Function b()
	Private Function d()
	Public Function c()
 
 aProcNamesArray  40191C
	.text:0040191C     dd offset aA  
	.text:00401920     dd 0
	.text:00401924     dd 0
	.text:00401928     dd offset aC  

PrivObj.FuncTypInf 
   dd offset Class1_PubFuncTypDesc_a_Func
   dd 0
   dd 0
   dd offset Class1_PubFuncTypDesc_c_Func	

'file layout of jumps by address ascending
.text:004014AC   jmp     sub_401EF0    'index 0  AAAAAAAA
.text:004014B9   jmp     loc_401FA0    'index 1  BBBBBBBB
.text:004014C6   jmp     sub_402040    'index 2  DDDDDDDD
.text:004014D3   jmp     sub_402110    'index 3  CCCCCCCC
The public functions have entries in the ProcNames array and PrivFuncInfo that correspond to their source function index, with private functions being null.

For PCode exes, the MethodLinks table would be parallel as well.
004014AC   
004014B9    
004014C6   
004014D3
For native exes, they have shuffled the MethodLinks around so public functions come first.
obj.objinfo.aMethodLinkTable    401474   
	.text:00401474  dd 4014ACh ->  AAAAAAAA
	.text:00401478  dd 4014D3h ->  CCCCCCCC
	.text:0040147C  dd 4014B9h ->  BBBBBBBB
	.text:00401480  dd 4014C6h ->  DDDDDDDD
So..to apply the correct function prototype, which I was so happy about..actually it looks like we are going to have to sort the functions based on the either function address ascending or the actual address in the method link table and not method link array index.

Kind of a pain in the ass but it is what it is apparently...

This shuffle was probably done for.... I have no good theory. It doesnt really matter what the vtable looks like, but private functions are in the vtable as well, just all at the end. (Yes we can call private functions by vtable offset)

Maybe someone had OCD?

I mostly have developed this working with PCode because thats where my first interest was. In order to start working more with native and do more spot checks..I am now implementing a basic native disassembler along with it as well..in for a penny in for a pound i guess...

Anyway, be aware of the bug in Misapplied names for native compiles. Ima n00b. (fixed 12.2.22)

In other news I have another fun blog post coming on decoded soon.






Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 17 + 81 = ? followed by the letter: C 



About Me
More Blogs
Main Site
Posts: (year)
2026 (2)
     VBDec AI Automation
     Misc Updates
2025 (12)
     Close IDA decompiler windows
     IDA Xrefs From/To
     IDA Jscript 3 Beta
     IDA JScript Updates
     IdaCompare StringDiff
     Sensationalization
     iPhone to PC Dictation
     pediff and chatgpt
     Py Magic Numbers
     upside down pyramid
     IDA Compare Updates
     Bindiff Niceity
2024 (1)
     MAP Update
2023 (6)
     Yara Workbench Automation
     VS linker versions
     IDA decompiler comments
     PublicBytes struct
     DispCallFunc
     VB6 Class Instances
2022 (7)
     VB6 Implements
     VBDec Bug
     vbdec remote scripting
     VB6 Stubs BS
     VB6 TypeInfo
     VB6 VTable Layout
     Yara isPCode rule
2021 (4)
     VB6 Hijacking
     rtcTypeName
     VB6 Gosub
     VB App object
2020 (8)
     AutoIT versions
     IDA JScript 2
     Using VB6 Obj files from C
     Vb6 PCode Internals
     Vb6 Runtime ForLoop Disasm
     VB6 Pcode - For Loops
     Yara Corrupt Imports
     Yara Undefined values
2019 (12)
     Yara WorkBench
     SafeArrayGetVartype
     vbdec dbg updates
     vb6 PCode NOP
     vb6 API and call backs
     how pcode works Pt1
     PrintFile
     ImpAdCallNonVirt
     Reversing PCode Args
     VB6 PCode Disassembly
     VB6 PCode Debugger
     UConnect Disable Cell Modem
2017 (5)
     IDA python over IPC
     dns wildcard blocking
     64bit IDA Plugins
     anterior lines
     misc news/updates
2016 (4)
     KANAL Mod
     Decoders again
     CDO.Message Breakpoints
     SysAnalyzer Updates
2015 (5)
     SysAnalyzer and Site Updates
     crazy decoder
     ida js w/dbg
     flash patching 2
     JS Graphing
2014 (5)
     Delphi IDA Plugin
     scdbg IDA integration
     API Hash Database
     Winmerge plugin
     IDACompare Updates
2013 (9)
     Guest Post @ hexblog
     TCP Stream Reassembly
     SysAnalyzer Updates
     Apilogger Video
     Shellcode2Exe trainer
     scdbg updates
     IDA Javascript w/IDE
     Rop Analysis II
     scdbg vrs ROP
2012 (13)
     flash patching
     x64 Hooks
     micro hook
     jmp api+5 *2
     SysAnalyzer Updates
     InjDll runtime config
     C# Asm/Dsm Library
     Shellcode Hook Detection
     Updates II
     findDll
     Java Hacking
     Windows 8
     Win7 x64
2011 (19)
     Graphing ideas
     .Net Hacking
     Old iDefense Releases
     BootLoaders
     hll shellcode
     ActionScript Tips
     -patch fu
     scdbg ordinal lookup
     scdbg -api mode
     Peb Module Lists
     scdbg vrs Process Injection
     GetProcAddress Scanner
     scdbg fopen mode
     scdbg findsc mode
     scdbg MemMonitor
     demo shellcodes
     scdbg download
     api hashs redux
     Api hash gen
2010 (11)
     Retro XSS Chat Codes
     Exe as DLL
     Olly Plugins
     Debugging Explorer
     Attach to hidden process
     JS Refactoring
     Asm and Shellcode in CSharp
     Fancy Return Address
     PDF Stream Dumper
     Malcode Call API by Hash
     WinDbg Cheat Sheet
2009 (1)
     GPG Automation