• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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