• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

WriteProcessMemory fails and crashes because of DEP (Data Execution Prevention)

Hi

I have a piece of code similar to
http://www.codeproject.com/KB/threads/winspy.aspx

It's function injection (code injection) into another process using WriteProcessMemory and VirtualAllocEx etc.

But it fails because DEP is enabled in my PC and I get a message about DEP error.

How I can solve it without disabling DEP? or disabling DEP but without needing for PC or app restart or it's because of DEP or it's wrong message?

Thanks from now!
0
CSecurity
Asked:
CSecurity
  • 2
1 Solution
 
jkrCommented:
You cannot do that without disabling DEP in general. One attempt that could work would be to use 'VirtualProtectEx()' to set the 'execute' flag for the memory you are writing to, but I am not sure whether DEP prevents that also.
0
 
CSecurityAuthor Commented:
Thank you so much, I tried VirtualProtectEx, again no luck!

First I get a message about DEP, then I get Sending Report Crash window.
0
 
CSecurityAuthor Commented:
Here is 2 screen I see
test1.jpg
test2.jpg
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now