首页 > 代码库 > Add more security in Visual Studio 2012
Add more security in Visual Studio 2012
- Compile flags:
- /GS: Stack protection from buffer overrun.
- /SDL: Subset of W3&W4 security warnings as errors.
- Use warning 4.
- /WX: Treat Warnings As Errors.
- Linker flags:
- /DYNAMICBASE: Randomize module base address to ensure that our code is at different location each time it is loaded.
- /NXCOMPAT: Data Execution Prevention to ensure that data is difficult to execute.
- /SAFESEH: Secure Exception Handling. Project->Properties->Linker->Advanced->Image has Safe Exception Handlers.
- Using VS Code Analysis to find vulnerability.
- Including Banned.h in projects to find unsafe methods which are listed in Banned.h.
- Using BannedAPIextension to flag banned api use in editor. (only available for VS2010)
- Enable /SEHOP in registry setting:
- Click Start, click Run, type regedit, and then press ENTER.
- Locate the following registry subkey:Note If you cannot find the DisableExceptionChainValidation registry entry under theHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\DisableExceptionChainValidationHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\subkey, follow these steps to create it:
- Right-click kernel, point to New, and then click DWORD Value.
- Type DisableExceptionChainValidation, and then press ENTER.
- Double-click DisableExceptionChainValidation.
- Change the value of the DisableExceptionChainValidation registry entry to 0 to enable it, and then click OK.
Note A value of 1 disables the registry entry. A value of 0 enables it.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。