Software Security
Program Analysis with PREfast & SAL
Erik Poll
Digital Security group Radboud University Nijmegen
1
Program Analysis with PREfast & SAL Erik Poll Digital Security - - PowerPoint PPT Presentation
Software Security Program Analysis with PREfast & SAL Erik Poll Digital Security group Radboud University Nijmegen 1 Static analysis aka source code analysis Automated analysis at compile time to find potential bugs Broad range of
1
2
3
4
5
6
7
BOOL AddTail(LPVOID p) { ... if(queue.GetSize() >= this->_limit); { while(queue.GetSize() > this->_limit-1) { ::WaitForSingleObject(handles[SemaphoreIndex], 1); q
8
9
OOL AddTail(LPVOID p) { ... if(queue.GetSize() >= this->_limit); { while(queue.GetSize() > this->_limit-1) { ::WaitForSingleObject(handles[SemaphoreIndex], 1); que
static OSStatus SSLVerifySignedServerKeyExchange (SSLContext *ctx, bool isRsa, SSLBuffer signedParams, uint8_t *signature, UInt16 signatureLen) { OSStatus err; .. if((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail; if((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; if((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) goto fail; ... fail: SSLFreeBuffer(&signedHashes); SSLFreeBuffer(&hashCtx); }
10
11
OOL AddTail(LPVOID p) { ... if(queue.GetSize() >= this->_limit); { while(queue.GetSize() > this->_limit-1) { ::WaitForSingleObject(handles[SemaphoreIndex], 1); que
(hard to check for code analyser, but for a constant is may be doable)
12
OOL AddTail(LPVOID p) { ... if(queue.GetSize() >= this->_limit); { while(queue.GetSize() > this->_limit-1) { ::WaitForSingleObject(handles[SemaphoreIndex], 1); que
13
OOL AddTail(LPVOID p) { ... if(queue.GetSize() >= this->_limit); { while(queue.GetSize() > this->_limit-1) { ::WaitForSingleObject(handles[SemaphoreIndex], 1); que
14
integer overflow in conversion of 64 bit float to 16 bit int
https://www.youtube.com/watch?v=PK_yguLapgA
15
free tools for Java: CheckStyle, PMD, Findbugs,.... for C(++) from Microsoft: PREfix, PREfast, FxCop outdated, but free tools focusing on security
commercial
for web-applications
for many languages: Semmle (bought by github)
16
easy & fun to download and try out!
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36