安全的編譯你的程式

 

 

https://www.rsaconference.com/writable/presentations/file_upload/asec-f02-writing-secure-software-is-hard-but-at-least-add-mitigations_final.pdf

 

https://www.owasp.org/images/5/54/OWASPSpain8_VULNEX_BinSecSweeper.pdf

 

Microsoft Security Development Lifecycle (SDL) Process Guidance – Version 5.2

Exploitation相關技巧與防護

http://hick.org/~mmiller/presentations/misc/exploitation_techniques_and_mitigations_on_windows.pdf

 

工具  BinScope (Windows)

https://www.microsoft.com/en-us/download/details.aspx?id=44995

 

工具 checkSec.sh (Linux)

http://www.trapkit.de/tools/checksec.html

 

Compiler/Tool Minimum Required Version
and Switches/Options
Optimal/Recommended Version
and Switches/Options
Comments
C/C++ Compiler Microsoft Visual Studio .NET 2008
cl.exe Version 14.00.50727.42

Use /GS

Use /GS

 

Link.exe Version 8.00.50727.762
Use /SAFESEHUse /NXCOMPAT and don’t use /NXCOMPAT:NO.See Appendix F: SDL Requirement: No Executable Pages for more information.
Use /SAFESEH

Use /functionpadmin:5

Use /DYNAMICBASE

Visual Studio 2008 SP1 is needed for /DYNAMICBASE
MIDL.exe Version 6.00.0366

Use /robust

Use /robust
Source code analysis

 

Visual Studio 2008 Code Analysis Options (“/analyze”)

For Visual Studio 2008 code analysis, all warning IDs from the following list must be fixed: 4532 6029 6053 6057 6059 6063 6067 6200 6201 6202 6203 6204 6248 6259 6260 6268 6276 6277 6281 6282 6287 6288 6289 6290 6291 6296 6298 6299 6305 6306 6308 6334 6383

 

 

Visual Studio 2008 Code Analysis Options (“/analyze”).

For Visual Studio 2008 code analysis, all warning IDs from the following list must be fixed: 4532 6029 6053 6057 6059 6063 6067 6200 6201 6202 6203 6204 6248 6259 6260 6268 6276 6277 6281 6282 6287 6288 6289 6290 6291 6296 6298 6299 6305 6306 6308 6334 6383

 

Standard Annotation Language (SAL): Code annotated with SAL should correct additional warnings, in addition to those listed above. See Appendix H: SDL Standard Annotation Language (SAL) Recommendations for Native Win32 Code for more information. The warnings are summarized as follows:

 

SAL Compliance

Visual Studio 2008: 26020–26023

 

/analyze

Visual Studio 2008: 6029 6053 6057 6059 6063 6067 6201–6202 6248 6260 6276 6277 6305

Visual Studio 2008 Team Edition contains a publicly available version that is branded as “C/C++ Code Analysis.”

 

Protecting Against Heap Corruption n/a All executable programs written using unmanaged code (.EXE) must call the HeapSetInformation interface. See Appendix I: SDL Requirement: Heap Manager Fail Fast Setting for more information.
C4700 and C4701 Compiler Warnings n/a Compile code with C4700 and C4701 compiler warnings enabled and fix all instances of these warnings.

Leave a Reply

Your email address will not be published. Required fields are marked *