Sponsored by: █ Sparkhost - Hosting Without Compromises! █ Hybrid Performance Web Hosting █ Spark Host Stream Hosting █ Hybrid IRC & IRCd Server Shell Accounts
Getting The Handle To A File Which Is Opened
#1
Posted 29 May 2005 - 08:52 AM
i'm trying to get the handle to a file which is already opened with OF_SHARE_DENY_WRITE
by injecting code into the process which opened the file and then write to the file using the new handle. I've tried GetModuleHandle to get the handle, but it returns "module not found". Also i've tried reopening the file since i'm in the same process, but it returns "sharing violation". Anyone has a clue on how to do this?
Thanks in advance!
The Syringe - My Latest Project.
Errors, Vulnerabilities & Exploits explained.
----
www.white-scorpion.nl
www.info-sec.eu
www.info-sec.info
#2
Posted 29 May 2005 - 10:09 PM
belgther... aka... belgther
#3
Posted 30 May 2005 - 05:44 AM
Process explorer from sysinternals can show all open handles as well, so it must be possible, but how?
The Syringe - My Latest Project.
Errors, Vulnerabilities & Exploits explained.
----
www.white-scorpion.nl
www.info-sec.eu
www.info-sec.info
#4
Posted 30 May 2005 - 06:14 AM
belgther... aka... belgther
#5
Posted 30 May 2005 - 07:33 AM
#6
Posted 30 May 2005 - 09:04 AM
@aapje > i don't want to close it, i just want to borrow it for a second to make some adjustments
The Syringe - My Latest Project.
Errors, Vulnerabilities & Exploits explained.
----
www.white-scorpion.nl
www.info-sec.eu
www.info-sec.info
#7
Posted 30 May 2005 - 06:59 PM
belgther... aka... belgther
#8
Posted 31 May 2005 - 01:19 AM
@belgther > i would have to test it, but from reading it you have to specify a valid window name... i will go deeper into it...
@aapje > i don't want to close it, i just want to borrow it for a second to make some adjustments
yes but if you detour open or close file you can log the handle and use that handle to write to the file (not 100% if that would work but i think so because you get the same handle that the process uses so you should be able to write using it)
#9
Posted 31 May 2005 - 08:36 AM
@belgther > i've tried GetProp with several values for the first parameter (GetModuleHandle(NULL), etc) and with the 2nd value a string to the filename. unfortunately the function always returns "File not found".
Any other ideas guys?
The Syringe - My Latest Project.
Errors, Vulnerabilities & Exploits explained.
----
www.white-scorpion.nl
www.info-sec.eu
www.info-sec.info
#10
Posted 31 May 2005 - 08:11 PM
#11
Posted 01 June 2005 - 08:13 AM
The Syringe - My Latest Project.
Errors, Vulnerabilities & Exploits explained.
----
www.white-scorpion.nl
www.info-sec.eu
www.info-sec.info
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












