Add more security in Visual Studio 2012

Source: Internet
Author: User

  • 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:
      1. ClickStart, ClickRun, TypeRegedit, And then press Enter.
      2. Locate the following registry subkey: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ kernel \ disableexceptionchainvalidation Note If you cannot find Disableexceptionchainvalidation Registry entry under thehkey_local_machine \ System \ CurrentControlSet \ Control \ Session Manager \ kernel \ subkey, follow these steps to create it:
          1. Right-clickKernel, PointNew, And then clickDWORD Value.
          2. TypeDisableexceptionchainvalidation, And then press Enter.
      3. Double-clickDisableexceptionchainvalidation.
      4. Change the value ofDisableexceptionchainvalidationRegistry entry to 0 to enable it, and then clickOK.

        NoteA value of 1 disables the registry entry. A value of 0 enables it.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.