Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2012, 13:00
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 399
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 67 Times in 35 Posts
jonwil Reputation: 21
How to debug a program spawned by another program?

I have one program which spawns a second program. Due to how this stuff all works, running the second program manually is impossible. Is there a way I can load the second program into IDA, run the first program and somehow stop on the second program's entry point or something so I can apply breakpoionts and let it continue?
Or is that not possible?
Reply With Quote
  #2  
Old 10-18-2012, 17:19
Av0id Av0id is offline
VIP
 
Join Date: Jan 2006
Posts: 399
Rept. Given: 112
Rept. Rcvd 111 Times in 69 Posts
Thanks Given: 0
Thanks Rcvd at 15 Times in 15 Posts
Av0id Reputation: 100-199 Av0id Reputation: 100-199
what kind of software is it? what peid said about main executable?

if you mean armadillo debug-blocker, then catch moment when WriteProcessMemory writing memory at OEP and put EB FE there

if you mean simple CreateProcess then modify process creation flags to CREATE_SUSPENDED
Reply With Quote
The Following User Gave Reputation+1 to Av0id For This Useful Post:
bunion (11-17-2012)
  #3  
Old 10-18-2012, 19:01
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 399
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 67 Times in 35 Posts
jonwil Reputation: 21
Its for the Origin digital software store.
Origin.exe (main store program) runs. When you click "play" it starts OriginClientService.exe. This then starts the actual game exe (lets say RenegadeLauncher.exe for one of the exes I am working with). When RenegadeLauncher.exe runs, some unknown form of inter-process-communication is done between Origin.exe/OriginClientService.exe and RenegadeLauncher.exe to verify that its genuine and authorized and if it is, RenegadeLauncher.exe runs and does its work. If you run RenegadeLauncher.exe directly, it doesn't recieve whatever "this is legit" instructions it is looking for and instead of running, it starts Origin if needed, passes Origin a "play this game" instruction and then terminates (whereupon Origin starts the game as above)

The CREATE_SUSPENDED idea wont work because OriginClientService.exe does not use CreateProcess, it uses ShellExecuteEx.
Reply With Quote
  #4  
Old 10-19-2012, 16:58
cnbragon cnbragon is offline
Friend
 
Join Date: Nov 2010
Posts: 26
Rept. Given: 1
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 3
Thanks Rcvd at 1 Time in 1 Post
cnbragon Reputation: 1
Quote:
Originally Posted by jonwil View Post
Its for the Origin digital software store.
Origin.exe (main store program) runs. When you click "play" it starts OriginClientService.exe. This then starts the actual game exe (lets say RenegadeLauncher.exe for one of the exes I am working with). When RenegadeLauncher.exe runs, some unknown form of inter-process-communication is done between Origin.exe/OriginClientService.exe and RenegadeLauncher.exe to verify that its genuine and authorized and if it is, RenegadeLauncher.exe runs and does its work. If you run RenegadeLauncher.exe directly, it doesn't recieve whatever "this is legit" instructions it is looking for and instead of running, it starts Origin if needed, passes Origin a "play this game" instruction and then terminates (whereupon Origin starts the game as above)

The CREATE_SUSPENDED idea wont work because OriginClientService.exe does not use CreateProcess, it uses ShellExecuteEx.
ShellExecuteEx will call CreateProcessAsUser or CreateProcessInternal , so you can set breakpoint on this function, and change the dwCreationFlags parameter.
Reply With Quote
  #5  
Old 10-19-2012, 00:09
deepzero's Avatar
deepzero deepzero is offline
VIP
 
Join Date: Mar 2010
Location: Germany
Posts: 310
Rept. Given: 115
Rept. Rcvd 64 Times in 42 Posts
Thanks Given: 195
Thanks Rcvd at 224 Times in 95 Posts
deepzero Reputation: 64
if it does, it probably passes its arguments via command line arguments...which you can catch, skip the shell execute call and start it on your own.
Reply With Quote
  #6  
Old 10-19-2012, 07:06
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 399
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 67 Times in 35 Posts
jonwil Reputation: 21
I checked with process explorer and it doesn't seem to pass command line arguments.
Reply With Quote
  #7  
Old 10-19-2012, 12:29
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 399
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 67 Times in 35 Posts
jonwil Reputation: 21
I did some further analysis and it seems to be passing values in environment variables. However if I set those environment variables to the same values manually, it doesn't work (it gives me an error related to the copy protection and wont start the game)

The programmers at EA have obviously put a lot of work into making it hard to do exactly the thing I am trying to do (get the actual code behind the protection system into a debugger)
Reply With Quote
  #8  
Old 10-19-2012, 21:06
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 399
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 67 Times in 35 Posts
jonwil Reputation: 21
ok, sounds like I need to get origin.exe into the debugger, find a way to get it to launch originclientservice.exe suspended, get THAT into the debugger then find a way to get that to launch renegadelauncher.exe suspended and then I can get THAT into the debugger in order to find out what it does (assuming I can locate the correct place to plant a breakpoint to hit the OEP after the copy protection has done its thing)
Reply With Quote
  #9  
Old 10-20-2012, 00:28
deepzero's Avatar
deepzero deepzero is offline
VIP
 
Join Date: Mar 2010
Location: Germany
Posts: 310
Rept. Given: 115
Rept. Rcvd 64 Times in 42 Posts
Thanks Given: 195
Thanks Rcvd at 224 Times in 95 Posts
deepzero Reputation: 64
you could also patch the EP of the last process to EBFE (endless loop), and attach your debugger to the hanging process.
Reply With Quote
  #10  
Old 10-20-2012, 05:58
WaSt3d_ByTes WaSt3d_ByTes is offline
Friend
 
Join Date: Jul 2006
Posts: 60
Rept. Given: 10
Rept. Rcvd 11 Times in 4 Posts
Thanks Given: 42
Thanks Rcvd at 14 Times in 8 Posts
WaSt3d_ByTes Reputation: 11
Which game is that?
Reply With Quote
  #11  
Old 10-21-2012, 00:37
dyn!o's Avatar
dyn!o dyn!o is offline
Friend
 
Join Date: Nov 2003
Location: Own mind
Posts: 214
Rept. Given: 1
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 8
Thanks Rcvd at 0 Times in 0 Posts
dyn!o Reputation: 1
Did not you think about using Syser for this specifying case?
Reply With Quote
  #12  
Old 10-21-2012, 18:44
MarcElBichon MarcElBichon is offline
VIP
 
Join Date: Jan 2002
Posts: 289
Rept. Given: 426
Rept. Rcvd 151 Times in 57 Posts
Thanks Given: 447
Thanks Rcvd at 306 Times in 99 Posts
MarcElBichon Reputation: 100-199 MarcElBichon Reputation: 100-199
Quote:
Originally Posted by dyn!o View Post
Did not you think about using Syser for this specifying case?
Nice to see you here
Reply With Quote
  #13  
Old 10-21-2012, 11:09
jonwil jonwil is offline
VIP
 
Join Date: Feb 2004
Posts: 399
Rept. Given: 2
Rept. Rcvd 21 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 67 Times in 35 Posts
jonwil Reputation: 21
Thanks, the infinate loop trick was just what I needed.
Point EP to infinate loop, run game through Origin, attach with IDA, set breakpoints (in this case to valuie used when it jumps to real EP), set current IP to real protection start IP and hit "go".
Reply With Quote
  #14  
Old 11-01-2012, 13:10
LaptoniC LaptoniC is offline
Family
 
Join Date: Jan 2002
Posts: 31
Rept. Given: 1
Rept. Rcvd 38 Times in 4 Posts
Thanks Given: 1
Thanks Rcvd at 7 Times in 5 Posts
LaptoniC Reputation: 38
It looks like your game is protected by CDCops or something equivalent. You can hook the function of ShellExecute or CreateProcess. There are different ways to hook the functions. You can use ApiHooks by EliCZ, Detorus by Microsoft or any other libraries. Or you may do by Poor LaptoniC's method. Create a kernel32.dll and create a stub functions for which calls original kernel32.dll function. Only change the ShellExecute, GetModuleHandle or any function which will be called first so that you can dump the process. It is bulky, messy but it works.
Reply With Quote
  #15  
Old 11-15-2012, 16:05
LaDidi LaDidi is offline
VIP
 
Join Date: Aug 2004
Posts: 222
Rept. Given: 2
Rept. Rcvd 11 Times in 10 Posts
Thanks Given: 64
Thanks Rcvd at 54 Times in 29 Posts
LaDidi Reputation: 11
You may put a breakpoint on the CreateProcessInternal().
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to view what another Program is doing when it is run? sojourner353 General Discussion 19 07-07-2012 00:17


All times are GMT +8. The time now is 15:00.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )