We present a framework to prevent code injection attacks in MS Windows using Native APIs in the operating system. By adopting the idea of diversity, this approach is implemented in a two-tier framework. The first tier permutes the Native API dispatch ID number so that only the Native API calls from legitimate sources are executed. The second tier provides an authentication process in case an attacker guesses the first-tier permutation order. The function call stack is back-traced to verify whether the original caller's return address resides within the legitimate process. The process is terminated and an alert is generated when an attack is suspected. Experiments indicate that our approach poses no significant overhead. Categories and Subject Descriptors D.4.6 [Operating Systems]: Security and Protection--invasive software, authentication, security kernels; D.2.0 [Software Engineering]: General--Protection mechanisms General Terms Security, Diversity Keywords Diversity, Windows N...