Veracode error with SetWindowsHookEx win API call

Aswin mc 0 Reputation points
2024-06-10T06:50:57.29+00:00

I am getting an Embedded Malicious Code (CWE ID 506) error while using the SetWindowsHookEx win API call and running a Veracode security scan. The error message states that this technique is typically used by rootkits or other malicious code. Can anyone help me resolve this error?

Windows development | Windows API - Win32
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2024-06-11T01:44:29.66+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Use the Win32 API (SetWindowsHookExA function) to place a hook, which may indicate malicious behavior. DLL injection can be used for legitimate purposes; However, it is also a common technique used by rootkits to execute malicious code.

    If your application is designed to inject a DLL into another process, you don't need to take any action. Otherwise, this code should be double-checked, as it is indicative of a rootkit or other malicious code.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.