SlideShare a Scribd company logo
Заголовок
ptsecurity.com
SAST, CWE, SEI CERT
and other smart words
from the information
security world
Sergey Khrenov
PVS-Studio
Developer
Заголовок
2
Speaker
Sergey Khrenov
C# developer, PVS-Studio
khrenov@viva64.com
www.viva64.com
Заголовок
3
Why you should listen to this talk
S - security
Заголовок
4
The issue – code base growth
• Linux 1.0.0 kernel: 176 250 lines of code
• Linux 4.11.7 kernel: 18 373 471 lines of code
• Photoshop 1.0 : 128 000 lines of code
• Photoshop CS 6 : 10 000 000 lines of code
• Density of errors is also growing, but nonlinearly
• Everyone wants SECURE code of high quality
• Old methods of quality control aren’t enough any more
Заголовок
5
When size matters
Заголовок
6
Error density (per 1 KLOC)
0
20
40
60
80
100
< 2 2-16 16-64 64-512 > 512
"Estimating Software Costs: Bringing Realism to Estimating" (Capers Jones, 2007)
Заголовок
7
How to fight with errors
• Do it right from the start (doesn’t work)
• Follow company rules
• Use “best practices”
• Code Review
• Couple development
• Test-driven development (TDD)
• Agile development
• Tools
Заголовок
8
A few words about Code Review
Заголовок
9
Example from practice (Mono project)
Заголовок
10
Example from practice (Mono project)
Заголовок
11
Example from practice (Mono project)
Заголовок
12
Tools
• Unit tests
• Functional tests
• Load tests
• …
• Dynamic analysers
• Static analysers
Заголовок
13
Static analysis is…
Заголовок
14
Modern analysers
 Integration into IDE
 Integration into build systems and CI
 Incremental analysis
 Noise suppression mechanisms
Заголовок
15
Slow help is no help
0
1000
2000
3000
4000
5000
6000
7000
8000
Development Build QA Release Phase
Cost to Fix a Security Defect ($)
NIST: National Institute of Standards and Technology
Заголовок
16
Programming errors and their consequences (Therac-25)
From June 1985 to
January 1987 year this
device has become the
reason for at least 6
radiation overdoses.
Some patients got tens
of thousands radiation
absorbed doses. At
least two people died
directly because of
overdoses.
Заголовок
17
Programming errors and their consequences (Ariane-5)
June 4, 1996,
spaceport Kure.
During the first
launch, at the 40th
second of the flight,
the rocket collapsed.
The reason is an error
in the on-board
software.
Заголовок
18
DevSecOps and SAST will help us
Заголовок
19
Increasing number of detected vulnerabilities
5632
16555
0
2000
4000
6000
8000
10000
12000
14000
16000
18000
2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018
https://www.cvedetails.com
Заголовок
20
Search for vulnerabilities
For legacy code, search for known vulnerabilities is optimal:
• Analogy - antiviruses
• No false positives
• Only known issues are found
• Especially useful in large old projects
For newly written code, the method of searching code defects in
order to prevent vulnerabilities is more effective.
Заголовок
21
SAST - Static Application Security Testing
• Static analysis is aimed at searching and preventing
vulnerabilities
• Vulnerabilities are often ordinary bugs (according to the
data from NIST, more than 60%)
• SAST tools help to prevent vulnerabilities and provide
support of development security standards: CWE,
MISRA, SEI CERT and others.
Заголовок
22
SAST - Static Application Security Testing
Pros:
• Early problem detection
• Entire code coverage
• Good at searching typos and errors of the Copy-Paste type
Cons:
• False positives
• Exact error criticality is not defined
• Weak detection of memory leaks and parallel errors
Заголовок
23
Path to a real vulnerability
CWE - Common Weakness
Enumeration
CVE - Common Vulnerabilities
and Exposures
Заголовок
24
CWE
• CWE™ is a community-developed list of common
software security weaknesses
• https://cwe.mitre.org
• List of more than 800 potential vulnerabilities,
which can become real
Заголовок
25
CWE: examples of potential vulnerabilities
• CWE-14: Compiler Removal of Code to Clear Buffers
• CWE-20: Improper Input Validation
• CWE-91: XML Injection
• CWE-457: Use of Uninitialized Variable
• CWE-467: Use of sizeof() on a Pointer Type
• CWE-562: Return of Stack Variable Address
Заголовок
26
CWE-14 (Compiler Removal of Code to Clear Buffers)
void win32_dealloc(struct event_base *_base, void *arg) {
struct win32op *win32op = arg;
....
memset(win32op, 0, sizeof(win32op));
free(win32op);
}
The compiler could delete the 'memset' function call, which is used
to flush 'win32op' object.
Заголовок
27
CWE-687 (Function Call With Incorrectly Specified Argument Value)
void win32_dealloc(struct event_base *_base, void *arg) {
struct win32op *win32op = arg;
....
memset(win32op, 0, sizeof(win32op));
free(win32op);
}
The memset function receives the pointer and its size as arguments.
It is possibly a mistake. Inspect the third argument.
Заголовок
28
CWE-563 (Assignment to Variable without Use)
public string Region
{
get {....}
set
{
if (String.IsNullOrEmpty(value))
{
this.linker.s3.region = "us-east-1";
}
this.linker.s3.region = value;
}
}
The 'this.linker.s3.region' variable is assigned values twice
successively. Perhaps this is a mistake.
Заголовок
29
CWE-674 (Uncontrolled Recursion)
OnFailure? onFailure = null;
public OnFailure? OnFailure
{
get { return this.OnFailure; }
set { this.onFailure = value; }
}
Possible infinite recursion inside 'OnFailure' property.
Заголовок
30
CVE
• CVE® is a list of publicly known cybersecurity
vulnerabilities
• https://cve.mitre.org/
• List of more than 114 000 actual vulnerabilities found in
applications
Заголовок
31
CVE-2012-2122
typedef char my_bool;
my_bool
check_scramble(const char *scramble_arg, const char *message,
const uint8 *hash_stage2)
{
....
return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE);
}
[CWE-197] Saving the 'memcmp' function result inside the 'char' type
variable is inappropriate. The significant bits could be lost
breaking the program's logic.
Заголовок
32
CVE-2013-4258
if (NasConfig.DoDaemon) {
openlog("nas", LOG_PID, LOG_DAEMON);
syslog(LOG_DEBUG, buf);
closelog();
} else {
errfd = stderr;
}
[CWE-134] It's dangerous to call the 'syslog' function in such
a manner, as the line being passed could contain format
specification. The example of the safe code: printf("%s", str).
Network Audio System
Заголовок
33
CVE-2014-1266
static OSStatus
SSLVerifySignedServerKeyExchange(....)
{
....
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
goto fail;
goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
goto fail;
....
fail:
....
}
[CWE-483] The code's operational logic does not correspond with its formatting.
[CWE-561] Unreachable code detected. It is possible that an error is present.
Заголовок
34
MISRA C/C++
• Motor Industry Software Reliability Association
• Coding standard, which reduces the likelihood of making an
error for highly dependable embedded systems
• Proprietary
• MISRA C 2012 contains 143 rules
• MISRA C++ 2008 contains 228 rules
Заголовок
35
MISRA C/C++ (some rules)
• Don’t use octal constants
• Don’t use goto
• Function has to be single-exit
• Don’t use functions of the standard library
(atof/…/abort/exit/getenv/system/…)
• Don’t use dynamic allocations
• Don’t use unions
• Each case has to end with break or throw
Заголовок
36
MISRA C/C++ (Toyota)
• NHTSA: during 2000 - 2010
years 89 people died in
accidents, 57 were injured
• NHTSA and NASA made an
investigation
• 7 134 MISRA violations are
detected
• Toyota denies the guilt, but pays 16 billion dollars in the pre-trial
order
Заголовок
37
SEI CERT
• Coding standard
• Developed by CERT (CERT Coordination Center,
CERT/CC)
• Meant to C, C++, Java, Perl languages
• Quite similar to CWE
Заголовок
38
SEI CERT (some rules)
• MSC06-C: Beware of compiler optimizations
• INT33-C: Ensure that division and remainder operations
do not result in divide-by-zero errors
• EXP33-C, EXP53-CPP: Do not read uninitialized memory
• ARR01-C: Do not apply the sizeof operator to a pointer
when taking the size of an array
• DCL30-C: Declare objects with appropriate storage
durations
Заголовок
39
Introduce and use SAST correctly
• Chose an appropriate analyser
• Configure it
• Check a project, consider current warnings as a
technical debt
• Work with new warnings
• Introduce SAST in CI systems
• Set SAST on the machines
• ….
• PROFIT!!!
Заголовок
40
Mistaken beliefs related to SAST
• Expensive
• Not for newbies
• Difficult to introduce in a large project
• Silver bullet
Заголовок
41
Decrease losses
• Vulnerability occurrence
• Direct and indirect losses:
• Exploitation by intruders
• Bug bounty
• Reputation
• Correction
• Release update
$
$
$
$
$
$
$
Заголовок
42
Decrease losses
• Vulnerability occurrence
• Detection using SAST, correction
• Direct and indirect losses:
• Exploitation by intruders
• Bug bounty
• Reputation
• Correction
• Update release
$
$
$
$
$
$
$
Заголовок
43
Takeaway
 Security issues are expensive if they get in the final product
 SAST tools are one of the ways to detect vulnerabilities
 However, we recommend using any other available methods
 If your company earns money using programming code, you
have to think about its security
Заголовок
ptsecurity.com
Спасибо!
Спасибо!

More Related Content

PPTX
SAST and Application Security: how to fight vulnerabilities in the code
PPTX
PVS-Studio is ready to improve the code of Tizen operating system
PDF
Deliberately Un-Dependable Applications: the Role of Dependability Metrics in...
PDF
Offensive cyber security: Smashing the stack with Python
PPTX
Buffer overflow attacks
PPTX
Search for Vulnerabilities Using Static Code Analysis
PPTX
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
PPTX
CodeChecker Overview Nov 2019
SAST and Application Security: how to fight vulnerabilities in the code
PVS-Studio is ready to improve the code of Tizen operating system
Deliberately Un-Dependable Applications: the Role of Dependability Metrics in...
Offensive cyber security: Smashing the stack with Python
Buffer overflow attacks
Search for Vulnerabilities Using Static Code Analysis
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
CodeChecker Overview Nov 2019

What's hot (20)

PDF
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
PDF
Embedded device hacking Session i
PDF
SnakeGX (short version)
PDF
SnakeGX (full version)
PPT
B-Sides Seattle 2012 Offensive Defense
PDF
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
PDF
SmartphoneHacking_Android_Exploitation
PDF
IoT Malware: Comprehensive Survey, Analysis Framework and Case Studies
PPTX
Static Code Analysis for Projects, Built on Unreal Engine
PDF
Secure Coding Practices for Middleware
PDF
Automatic tool for static analysis
PDF
From Thousands of Hours to a Couple of Minutes: Automating Exploit Generation...
PPTX
Сканирование с использованием бэкслэша: подключаем интуицию
PDF
National software testing conference 2016 fergal hynes
PDF
MITRE ATT&CKcon 2018: Building an Atomic Testing Program, Brian Beyer, Red Ca...
PPTX
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PDF
Exspectre NDSS 2019
PPTX
Singapore International Cyberweek 2020
ODP
Java code coverage with JCov. Implementation details and use cases.
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
Embedded device hacking Session i
SnakeGX (short version)
SnakeGX (full version)
B-Sides Seattle 2012 Offensive Defense
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
SmartphoneHacking_Android_Exploitation
IoT Malware: Comprehensive Survey, Analysis Framework and Case Studies
Static Code Analysis for Projects, Built on Unreal Engine
Secure Coding Practices for Middleware
Automatic tool for static analysis
From Thousands of Hours to a Couple of Minutes: Automating Exploit Generation...
Сканирование с использованием бэкслэша: подключаем интуицию
National software testing conference 2016 fergal hynes
MITRE ATT&CKcon 2018: Building an Atomic Testing Program, Brian Beyer, Red Ca...
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
Exspectre NDSS 2019
Singapore International Cyberweek 2020
Java code coverage with JCov. Implementation details and use cases.
Ad

Similar to SAST, CWE, SEI CERT and other smart words from the information security world (20)

PDF
What’s eating python performance
PDF
Getting started with RISC-V verification what's next after compliance testing
PPTX
The operation principles of PVS-Studio static code analyzer
PDF
100 bugs in Open Source C/C++ projects
PPTX
Static code analyzers as a DevSecOps solution
PPTX
Navigating the jungle of Secure Coding Standards
PPTX
Price of an Error
PPTX
CodeChecker summary 21062021
PPTX
Cryptography_additive_cipher.pptx
PDF
BSides Vegas 2024_ Don’t Make This Mistake_ Painful Learnings of Applying AI ...
PPTX
200 Open Source Projects Later: Source Code Static Analysis Experience
PDF
Vulnerability Detection Based on Git History
PDF
Monitoring a program that monitors computer networks
PDF
Automatisez la détection des menaces et évitez les faux positifs
PDF
Presentation by Lionel Briand
PPTX
Talos: Neutralizing Vulnerabilities with Security Workarounds for Rapid Respo...
PDF
Surge2012
PPT
Fault Detection Scheme for AES Using Composite Field
PPTX
PVS-Studio and static code analysis technique
PDF
Pre New Year Check of PostgreSQL
What’s eating python performance
Getting started with RISC-V verification what's next after compliance testing
The operation principles of PVS-Studio static code analyzer
100 bugs in Open Source C/C++ projects
Static code analyzers as a DevSecOps solution
Navigating the jungle of Secure Coding Standards
Price of an Error
CodeChecker summary 21062021
Cryptography_additive_cipher.pptx
BSides Vegas 2024_ Don’t Make This Mistake_ Painful Learnings of Applying AI ...
200 Open Source Projects Later: Source Code Static Analysis Experience
Vulnerability Detection Based on Git History
Monitoring a program that monitors computer networks
Automatisez la détection des menaces et évitez les faux positifs
Presentation by Lionel Briand
Talos: Neutralizing Vulnerabilities with Security Workarounds for Rapid Respo...
Surge2012
Fault Detection Scheme for AES Using Composite Field
PVS-Studio and static code analysis technique
Pre New Year Check of PostgreSQL
Ad

More from Andrey Karpov (20)

PDF
60 антипаттернов для С++ программиста
PDF
60 terrible tips for a C++ developer
PPTX
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
PDF
PVS-Studio in 2021 - Error Examples
PDF
PVS-Studio in 2021 - Feature Overview
PDF
PVS-Studio в 2021 - Примеры ошибок
PDF
PVS-Studio в 2021
PPTX
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
PPTX
Best Bugs from Games: Fellow Programmers' Mistakes
PPTX
Does static analysis need machine learning?
PPTX
Typical errors in code on the example of C++, C#, and Java
PPTX
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
PPTX
Game Engine Code Quality: Is Everything Really That Bad?
PPTX
C++ Code as Seen by a Hypercritical Reviewer
PPTX
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
PPTX
The Great and Mighty C++
PPTX
Static code analysis: what? how? why?
PDF
Zero, one, two, Freddy's coming for you
PDF
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PDF
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...
60 антипаттернов для С++ программиста
60 terrible tips for a C++ developer
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Feature Overview
PVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Best Bugs from Games: Fellow Programmers' Mistakes
Does static analysis need machine learning?
Typical errors in code on the example of C++, C#, and Java
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
Game Engine Code Quality: Is Everything Really That Bad?
C++ Code as Seen by a Hypercritical Reviewer
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Great and Mighty C++
Static code analysis: what? how? why?
Zero, one, two, Freddy's coming for you
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
System and Network Administration Chapter 2
PPTX
Online Work Permit System for Fast Permit Processing
PDF
AI in Product Development-omnex systems
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
System and Network Administraation Chapter 3
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPT
Introduction Database Management System for Course Database
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Nekopoi APK 2025 free lastest update
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
medical staffing services at VALiNTRY
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
Transform Your Business with a Software ERP System
VVF-Customer-Presentation2025-Ver1.9.pptx
System and Network Administration Chapter 2
Online Work Permit System for Fast Permit Processing
AI in Product Development-omnex systems
ISO 45001 Occupational Health and Safety Management System
PTS Company Brochure 2025 (1).pdf.......
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Odoo POS Development Services by CandidRoot Solutions
System and Network Administraation Chapter 3
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Introduction Database Management System for Course Database
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Nekopoi APK 2025 free lastest update
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
medical staffing services at VALiNTRY
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
history of c programming in notes for students .pptx
Transform Your Business with a Software ERP System

SAST, CWE, SEI CERT and other smart words from the information security world