SlideShare a Scribd company logo
Built-in Security Mindfulness
for Software Developers
Phu H. Phung
Intelligent Systems Security Lab
Department of Computer Science, University of Dayton
https://isseclab-udayton.github.io/
March 11, 2020
Cyber Security Spends and Trends in Companies
•Spends and Trends: SANS 2020 IT Cybersecurity Spending
Survey
All about
network, i.e., cyber
security
But, most of cyber
attacks are not due
to network issues
1
Applications Continue To Be Companies’ Weakest
Security Link
2
Forrester: The State Of
Application Security, 2019
Top 71% of external
attacks are due to
software vulnerabilities
Software is vulnerable
3
Common Software Vulnerabilities
4
Software Security versus Network (Cyber) Security
5
Program
Process Data
(Structured Program
Internals)
Input Output
Call-out to
other programs
(also consider
input & output issues)
Software Security
Network Security Network Security
Software Security versus Network Security:
An example
•Assume that you are a Paypal user, and assume that Paypal
is on HTTPS and requires two-factor authentication, i.e.,
after providing username/password, you are required to
confirm the login in another device
Network security is fully guaranteed
•Discussion: is it safe for you to open a link like below while
you are logged in on Paypal?
https://www.paypal.com/eg/cgi-bin/cmd=flow&SESSION=Akl-tATMf1GOP-
tQu3t3x4Vju&…
6
Paypal was vulnerable to CSRF
7
Who should be responsible for the Paypal attack
example?
•The user?
 e.g., using anti-virus software?
•Your organization?
e.g., installing anti-virus software, using a proxy filtering,
firewalls?
•The Internet Provider?
e.g., installing firewalls?
Conventional Security Solutions
such as anti-virus software or
firewall cannot prevent attacks
caused by software
vulnerabilities 8
Conventional Security Mechanisms
•Firewall
•Cryptography
•Access control
•System calls/
privileged mode
Treat programs as black box,
cannot address vuneralbilities inside a program
9
Issues of Conventional Security Mechanisms and
Network Security
•Cannot address important current and future security
needs:
Downloaded, mobile code
Buffer overflow, code injection, data races, and other safety
problems
Web application security
Information flow control, e.g., privacy
10
Software Security
•Vulnerabilities in software that cause cyber attacks that can
not be prevented by conventional security mechanisms
 A vulnerability is a flaw in software mostly caused by software
developers
11
Chart source: Trend Micro and the Organization of American States (OAS)
Another Attack Example: A Buffer-Overflow
12
Enter Your PIN:
Attacker can inject
malicious code from input
to exploit vulnerable
programs
Buffer Overflow Example
• A simple program in C, e.g., myecho.c that just print the input:
• Compiling and execution
$ gcc myecho.c -o myecho
$ myecho OISC20
OISC20
Are there any issues
you can see in this
simple program?
How about?
$ myecho $(perl -e 'print "A"x150')
13
Buffer Overflow Attack Live Demo
14
Demo video: https://youtu.be/RAawLvKa-U0
Buffer-Over Flow Attack Examples
•The most common software vulnerabilities that causes
cyber attacks
•Recent and notable examples:
Wannacry, May 2017
o A Ransomware crippling systems worldwide
WhatsApp, May 2019
o Hackers compromise victims’ phone by a phone call that
automatically executes malicious code
15
Source: https://blog.securitycompass.com/wannacry-and-the-elephant-in-the-room-c9b24cfee2bd
16
17
Are buffer overflow attacks new?
•Buffer overflow is 40 years old!
18
Why does Buffer-Overflow happen?
•Data is read or written outside the bounds of a buffer
The attacker gets the program to treat the malicious data as
code
•How can this happen?
The developer did not check the data size or use insecure
functions in the program!!!
19
Software Development
•Based on a typical software engineering process
Normally developers
focus on the
functionalities
of the application
20
Image source: www.pinterest.com
Security in Software Development
•Developers mainly focus on the functionalities
Few developers know how to develop secure software
o Programming books/courses do not teach it
Most developers do not think like a hacker
o “How could this be attacked?” – be slightly paranoid
Developers do not learn from others’ security mistakes
o Most vulnerabilities caused by same mistakes over 40+ years
Credit: David A. Wheeler
21
Traditional Penetrate-and-Patch Software
Development Approach
•Once a software vulnerability is discovered (normally by
attackers), the software can be patched, but:
Unpatched systems remain vulnerable
Other vulnerabilities might still remain
New vulnerabilities might be discovered
•Zero-day vulnerability attacks exploit this Penetrate-and-
Patch approach
22
Zero-day vulnerabilities
•Undisclosed computer-software vulnerabilities
Hackers can exploit to adversely affect computer systems
oBefore the vulnerability is fixed and patched
23
Security at the source
•The developers should be responsible for security at the
design and development phase
Secure Development Lifecycle has been proposed
Source: “Improving Security Across the Software Development Lifecycle – Task Force Report”, April 1, 2004.
http://www.cyberpartnership.org/init.html; based on Gary McGraw 2004, IEEE Security and Privacy. Fair use asserted.
Credit: David A. Wheeler 24
Built-in Security Mindfulness for Software
Developers at UDayton-CS
•Understanding of the impact of software vulnerabilities (in
Software/Language-based Security course)
•Develop “Building Security In” Approach (in Secure
Application Development course)
Secure and Sustainability Principles and Practices in Application
Development
Avoid security problems at the design stage
25
Software Security/Language-based Security at
UDayton-CS
•Students will learn the practice of software security
how to identify vulnerabilities in computer systems
o white-hat hacker mindset !!!
how to defense against the possible vulnerabilities
•Students can understand the principles of language-based
security
how to design secure systems and write secure code
26
UDayton-CS hands-on example: SQLi Attacks
•Students will need to hack into a real web server (on a
Cyber Range), e.g.: http://myphoto.blog.com/
By exploring and exploiting its SQL Injection Vulnerabilities
Read the data from the database
Obtain the username/password
and login to the system
27
Detect the SQL Vulnerabilities
• Click on a link, e.g.:http://myphoto.blog.com/cat.php?id=1
 Recall HTTP GET Request, inputs are encoded in the URL
• Let’s try several different inputs to detect potential vulnerabilities:
 http://myphoto.blog.com/cat.php?id=1'
28
Detect the SQL Vulnerabilities - More
 http://myphoto.blog.com/cat.php?id=a
 http://myphoto.blog.com/cat.php?id=2-1
• Guessing?
29
SELECT xxx FROM xxx
WHERE xxx=<input>
Exploitation of SQL Injections
• We guessed the SQL
SELECT xxx FROM xxx WHERE xxx=<input>
• How to inject a SQL query for attacks?
 Use UNION:
SELECT xxx FROM xxx WHERE xxx=value UNION SELECT ???
 UNION must have the same number of columns. How do we
know?
oTrials with errors, e.g.,:
• SELECT xxx FROM xxx WHERE xxx=value UNION SELECT 1
30
Exploitation of SQL Injections - more
• We guessed the SQL
SELECT xxx FROM xxx WHERE xxx=<input>
• Trials with errors, e.g.,:
 SELECT xxx FROM xxx WHERE xxx=value UNION SELECT
1
SELECT xxx FROM xxx WHERE xxx=value
UNION SELECT 1, 2
 ...
• Students first do hands-on to identify the number of
columns
 Carry out further attacks 31
Future Software security hacking environment
• We create a practical and
real environment for students
E.g.,:
https://myphoto.ss-lbs.me
for SQL Injection Attacks
https://myblog.ss-lbs.me
for XSS, SQLi, Session Hijacking
CSRF attacks
32
Discussion: How many columns used in the SQL in
https://myphoto.ss-lbs.me/cat.php?id=1
A. *
B. 1
C. 2
D. 3
E. 4
33
Demo: Retrieving username/password
with SQLi Attacks
Students can login with the stolen
username/password
34
Secure Application Development at UDayton-CS
• How to develop application software with “Building
Security In” Approach
 Secure and Sustainability Principles and Practices in Application
Development
Robust and Defensive Programming Techniques
Avoid security problems at the design stage
o Developers with hacker mindset!!
35
Secure Application Development Example:
A Simple Login System
•Code (from the scratch) to authenticate users with
username/password
Check on real database (MySQL)
•Then think as a hacker!
 Doing self-attacks
 Implementing secure code
The query:
SELECT * FROM users where username='admin' AND
password=password('thepassword');
thepassword
36
Username/password check from Database
37
Discussion: What are the potential security risks in this SQL statement?
A. No input validation
B. Attackers can inject SQL code
C. Attackers can inject JavaScript code
D. A and B
E. A, B, and C
sql=SELECT * FROM users where username=' '
AND password=password(' ')
P4$$w0rd
admin
P4$$w0rd
Self-attack Demo: Mixed SQL and JavaScript
38
admin' #<script>alert(document.cookie)</script>
This is an example of code
injection attacks, mixing
SQL and JavaScript. Will be
covered in detail next steps
Prepared Statements in PHP/MySQL
39
Vulnerable SQL Statement
OWASP Primary Defenses against SQL Injection Attacks:
Option #1: Use of Prepared Statements
Built-in Security Mindfulness for Software
Developers at UDayton-CS: A Reflection
•Stable and increasing enrollment
•Very high positive feedback from students
Yoursecureapplication projectis veryusefulforattending interviews.
Dr.Phung,
Ijust wantedtothankyouandalsoletyouknowhowbeneficial yourclass wasinan
interviewIhadacoupleweeksago.
…
Yourclassbenefited meextremelyandIjustwantedtomakesurethatyouknewand
yousothatyoucantellyourclasses what employersmightaskabout.Iendedup
gettingajoboffer15minutes afterIleft theinterview,theysaidthattheywere
trulyimpressed with myrangeofknowledge.
40
Challenges and Opportunities
•Security courses are not mandatory for CS students
 Future developers still write insecure code !!!
•I welcome and look forward to opportunities
 Integrate security components in programming classes
 Collaborate with other colleges to explore the possibilities to
integrate security components in their curriculum
 Work with industry to propose a long-term solution
41
Thank you!
Phu H. Phung
Intelligent Systems Security Lab
Department of Computer Science, University of Dayton
https://isseclab-udayton.github.io/
March 11, 2020

More Related Content

PDF
How secure are your systems
PDF
Hiding in Plain Sight: The Danger of Known Vulnerabilities
PDF
Secure Coding and Threat Modeling
PPT
Web Application Testing for Today’s Biggest and Emerging Threats
PPTX
7 Steps to Threat Modeling
PDF
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
PPTX
Ethical Hacking Conference 2015- Building Secure Products -a perspective
PDF
"CERT Secure Coding Standards" by Dr. Mark Sherman
How secure are your systems
Hiding in Plain Sight: The Danger of Known Vulnerabilities
Secure Coding and Threat Modeling
Web Application Testing for Today’s Biggest and Emerging Threats
7 Steps to Threat Modeling
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
Ethical Hacking Conference 2015- Building Secure Products -a perspective
"CERT Secure Coding Standards" by Dr. Mark Sherman

What's hot (20)

PDF
Developing a Threat Modeling Mindset
PPTX
Threat Modeling And Analysis
PDF
Tech Report: On the Effectiveness of Malware Protection on Android
PDF
Rapid Threat Modeling : case study
PPTX
Owasp A9 USING KNOWN VULNERABLE COMPONENTS IT 6873 presentation
PPT
Application Threat Modeling
PPTX
Application Threat Modeling
PDF
IT system security principles practices
PDF
From velvet to silk there is still a lot of sweat
PDF
Matteo Meucci Software Security in practice - Aiea torino - 30-10-2015
PDF
Secure coding presentation Oct 3 2020
PDF
Module 5 (system hacking)
PDF
Software Security Engineering (Learnings from the past to fix the future) - B...
PDF
An Introduction to Secure Application Development
PPTX
Vulnerability assessment &amp; Penetration testing Basics
PDF
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
PDF
APT - Project
PPT
Mobile application security and threat modeling
PDF
Module 2 (footprinting)
PPTX
Penetration testing dont just leave it to chance
Developing a Threat Modeling Mindset
Threat Modeling And Analysis
Tech Report: On the Effectiveness of Malware Protection on Android
Rapid Threat Modeling : case study
Owasp A9 USING KNOWN VULNERABLE COMPONENTS IT 6873 presentation
Application Threat Modeling
Application Threat Modeling
IT system security principles practices
From velvet to silk there is still a lot of sweat
Matteo Meucci Software Security in practice - Aiea torino - 30-10-2015
Secure coding presentation Oct 3 2020
Module 5 (system hacking)
Software Security Engineering (Learnings from the past to fix the future) - B...
An Introduction to Secure Application Development
Vulnerability assessment &amp; Penetration testing Basics
An Example of use the Threat Modeling Tool (FFRI Monthly Research Nov 2016)
APT - Project
Mobile application security and threat modeling
Module 2 (footprinting)
Penetration testing dont just leave it to chance
Ad

Similar to Built-in Security Mindfulness for Software Developers (20)

PPT
Chapter 2- Software Security FULL SLIDES.ppt
PPTX
Uncover What's Inside the Mind of a Hacker
PPTX
How Does a Data Breach Happen?
PPTX
Reveal the Security Risks in the software Development Lifecycle Meetup 060320...
PDF
" onclick="alert(1)
PDF
&lt;marquee>html title testfsdjk34254&lt;/marquee>
PDF
1_Introduction.pdf
PDF
Secure codingguide
PDF
Application Security Guide for Beginners
PDF
Secure coding guidelines
DOCX
21CSB02T WEB APPLICATION AND SECURITY NOTES
PPT
Software Security Testing
PPTX
Network security, seriously?
PDF
Application Security Testing for Software Engineers: An approach to build sof...
PPT
PHP Security Basics
DOCX
21CSB02T UNIT 1 NOTES. FOR WEB APPLICATION SECURITY VERTICAL COURSES
PPTX
Security Best Practices
PPT
Software security (vulnerabilities) and physical security
PPT
Software Security (Vulnerabilities) And Physical Security
PPT
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Chapter 2- Software Security FULL SLIDES.ppt
Uncover What's Inside the Mind of a Hacker
How Does a Data Breach Happen?
Reveal the Security Risks in the software Development Lifecycle Meetup 060320...
" onclick="alert(1)
&lt;marquee>html title testfsdjk34254&lt;/marquee>
1_Introduction.pdf
Secure codingguide
Application Security Guide for Beginners
Secure coding guidelines
21CSB02T WEB APPLICATION AND SECURITY NOTES
Software Security Testing
Network security, seriously?
Application Security Testing for Software Engineers: An approach to build sof...
PHP Security Basics
21CSB02T UNIT 1 NOTES. FOR WEB APPLICATION SECURITY VERTICAL COURSES
Security Best Practices
Software security (vulnerabilities) and physical security
Software Security (Vulnerabilities) And Physical Security
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Ad

More from Phú Phùng (10)

PPTX
Web security: Securing Untrusted Web Content in Browsers
PPTX
Self-Protecting JavaScript: A Lightweight Approach to Enforcing Security Poli...
PPTX
Web security: Securing untrusted web content at browsers
PPTX
Fine-grained policy enforcement for untrusted software
PPTX
Governing Bot-as-a-Service in Sustainability Platforms - Issues and Approaches
PPTX
Safe Wrappers and Sane Policies for Self Protecting JavaScript
PPTX
Lightweight Self-Protecting JavaScript
PPT
Security Policy Enforcement for the OSGi Framework using Aspect-Oriented Pr...
PPTX
Lightweight Self-Protecting JavaScript
PPTX
A Two-Tier Sandbox Architecture for Untrusted JavaScript
Web security: Securing Untrusted Web Content in Browsers
Self-Protecting JavaScript: A Lightweight Approach to Enforcing Security Poli...
Web security: Securing untrusted web content at browsers
Fine-grained policy enforcement for untrusted software
Governing Bot-as-a-Service in Sustainability Platforms - Issues and Approaches
Safe Wrappers and Sane Policies for Self Protecting JavaScript
Lightweight Self-Protecting JavaScript
Security Policy Enforcement for the OSGi Framework using Aspect-Oriented Pr...
Lightweight Self-Protecting JavaScript
A Two-Tier Sandbox Architecture for Untrusted JavaScript

Recently uploaded (20)

PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
Nekopoi APK 2025 free lastest update
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Oracle Fusion HCM Cloud Demo for Beginners
Adobe Illustrator 28.6 Crack My Vision of Vector Design
iTop VPN Free 5.6.0.5262 Crack latest version 2025
How to Choose the Right IT Partner for Your Business in Malaysia
Advanced SystemCare Ultimate Crack + Portable (2025)
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Salesforce Agentforce AI Implementation.pdf
CHAPTER 2 - PM Management and IT Context
Design an Analysis of Algorithms II-SECS-1021-03
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
AutoCAD Professional Crack 2025 With License Key
Odoo Companies in India – Driving Business Transformation.pdf
Computer Software and OS of computer science of grade 11.pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Navsoft: AI-Powered Business Solutions & Custom Software Development
Operating system designcfffgfgggggggvggggggggg
Autodesk AutoCAD Crack Free Download 2025
Nekopoi APK 2025 free lastest update
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41

Built-in Security Mindfulness for Software Developers

  • 1. Built-in Security Mindfulness for Software Developers Phu H. Phung Intelligent Systems Security Lab Department of Computer Science, University of Dayton https://isseclab-udayton.github.io/ March 11, 2020
  • 2. Cyber Security Spends and Trends in Companies •Spends and Trends: SANS 2020 IT Cybersecurity Spending Survey All about network, i.e., cyber security But, most of cyber attacks are not due to network issues 1
  • 3. Applications Continue To Be Companies’ Weakest Security Link 2 Forrester: The State Of Application Security, 2019 Top 71% of external attacks are due to software vulnerabilities
  • 6. Software Security versus Network (Cyber) Security 5 Program Process Data (Structured Program Internals) Input Output Call-out to other programs (also consider input & output issues) Software Security Network Security Network Security
  • 7. Software Security versus Network Security: An example •Assume that you are a Paypal user, and assume that Paypal is on HTTPS and requires two-factor authentication, i.e., after providing username/password, you are required to confirm the login in another device Network security is fully guaranteed •Discussion: is it safe for you to open a link like below while you are logged in on Paypal? https://www.paypal.com/eg/cgi-bin/cmd=flow&SESSION=Akl-tATMf1GOP- tQu3t3x4Vju&… 6
  • 9. Who should be responsible for the Paypal attack example? •The user?  e.g., using anti-virus software? •Your organization? e.g., installing anti-virus software, using a proxy filtering, firewalls? •The Internet Provider? e.g., installing firewalls? Conventional Security Solutions such as anti-virus software or firewall cannot prevent attacks caused by software vulnerabilities 8
  • 10. Conventional Security Mechanisms •Firewall •Cryptography •Access control •System calls/ privileged mode Treat programs as black box, cannot address vuneralbilities inside a program 9
  • 11. Issues of Conventional Security Mechanisms and Network Security •Cannot address important current and future security needs: Downloaded, mobile code Buffer overflow, code injection, data races, and other safety problems Web application security Information flow control, e.g., privacy 10
  • 12. Software Security •Vulnerabilities in software that cause cyber attacks that can not be prevented by conventional security mechanisms  A vulnerability is a flaw in software mostly caused by software developers 11 Chart source: Trend Micro and the Organization of American States (OAS)
  • 13. Another Attack Example: A Buffer-Overflow 12 Enter Your PIN: Attacker can inject malicious code from input to exploit vulnerable programs
  • 14. Buffer Overflow Example • A simple program in C, e.g., myecho.c that just print the input: • Compiling and execution $ gcc myecho.c -o myecho $ myecho OISC20 OISC20 Are there any issues you can see in this simple program? How about? $ myecho $(perl -e 'print "A"x150') 13
  • 15. Buffer Overflow Attack Live Demo 14 Demo video: https://youtu.be/RAawLvKa-U0
  • 16. Buffer-Over Flow Attack Examples •The most common software vulnerabilities that causes cyber attacks •Recent and notable examples: Wannacry, May 2017 o A Ransomware crippling systems worldwide WhatsApp, May 2019 o Hackers compromise victims’ phone by a phone call that automatically executes malicious code 15
  • 18. 17
  • 19. Are buffer overflow attacks new? •Buffer overflow is 40 years old! 18
  • 20. Why does Buffer-Overflow happen? •Data is read or written outside the bounds of a buffer The attacker gets the program to treat the malicious data as code •How can this happen? The developer did not check the data size or use insecure functions in the program!!! 19
  • 21. Software Development •Based on a typical software engineering process Normally developers focus on the functionalities of the application 20 Image source: www.pinterest.com
  • 22. Security in Software Development •Developers mainly focus on the functionalities Few developers know how to develop secure software o Programming books/courses do not teach it Most developers do not think like a hacker o “How could this be attacked?” – be slightly paranoid Developers do not learn from others’ security mistakes o Most vulnerabilities caused by same mistakes over 40+ years Credit: David A. Wheeler 21
  • 23. Traditional Penetrate-and-Patch Software Development Approach •Once a software vulnerability is discovered (normally by attackers), the software can be patched, but: Unpatched systems remain vulnerable Other vulnerabilities might still remain New vulnerabilities might be discovered •Zero-day vulnerability attacks exploit this Penetrate-and- Patch approach 22
  • 24. Zero-day vulnerabilities •Undisclosed computer-software vulnerabilities Hackers can exploit to adversely affect computer systems oBefore the vulnerability is fixed and patched 23
  • 25. Security at the source •The developers should be responsible for security at the design and development phase Secure Development Lifecycle has been proposed Source: “Improving Security Across the Software Development Lifecycle – Task Force Report”, April 1, 2004. http://www.cyberpartnership.org/init.html; based on Gary McGraw 2004, IEEE Security and Privacy. Fair use asserted. Credit: David A. Wheeler 24
  • 26. Built-in Security Mindfulness for Software Developers at UDayton-CS •Understanding of the impact of software vulnerabilities (in Software/Language-based Security course) •Develop “Building Security In” Approach (in Secure Application Development course) Secure and Sustainability Principles and Practices in Application Development Avoid security problems at the design stage 25
  • 27. Software Security/Language-based Security at UDayton-CS •Students will learn the practice of software security how to identify vulnerabilities in computer systems o white-hat hacker mindset !!! how to defense against the possible vulnerabilities •Students can understand the principles of language-based security how to design secure systems and write secure code 26
  • 28. UDayton-CS hands-on example: SQLi Attacks •Students will need to hack into a real web server (on a Cyber Range), e.g.: http://myphoto.blog.com/ By exploring and exploiting its SQL Injection Vulnerabilities Read the data from the database Obtain the username/password and login to the system 27
  • 29. Detect the SQL Vulnerabilities • Click on a link, e.g.:http://myphoto.blog.com/cat.php?id=1  Recall HTTP GET Request, inputs are encoded in the URL • Let’s try several different inputs to detect potential vulnerabilities:  http://myphoto.blog.com/cat.php?id=1' 28
  • 30. Detect the SQL Vulnerabilities - More  http://myphoto.blog.com/cat.php?id=a  http://myphoto.blog.com/cat.php?id=2-1 • Guessing? 29 SELECT xxx FROM xxx WHERE xxx=<input>
  • 31. Exploitation of SQL Injections • We guessed the SQL SELECT xxx FROM xxx WHERE xxx=<input> • How to inject a SQL query for attacks?  Use UNION: SELECT xxx FROM xxx WHERE xxx=value UNION SELECT ???  UNION must have the same number of columns. How do we know? oTrials with errors, e.g.,: • SELECT xxx FROM xxx WHERE xxx=value UNION SELECT 1 30
  • 32. Exploitation of SQL Injections - more • We guessed the SQL SELECT xxx FROM xxx WHERE xxx=<input> • Trials with errors, e.g.,:  SELECT xxx FROM xxx WHERE xxx=value UNION SELECT 1 SELECT xxx FROM xxx WHERE xxx=value UNION SELECT 1, 2  ... • Students first do hands-on to identify the number of columns  Carry out further attacks 31
  • 33. Future Software security hacking environment • We create a practical and real environment for students E.g.,: https://myphoto.ss-lbs.me for SQL Injection Attacks https://myblog.ss-lbs.me for XSS, SQLi, Session Hijacking CSRF attacks 32
  • 34. Discussion: How many columns used in the SQL in https://myphoto.ss-lbs.me/cat.php?id=1 A. * B. 1 C. 2 D. 3 E. 4 33
  • 35. Demo: Retrieving username/password with SQLi Attacks Students can login with the stolen username/password 34
  • 36. Secure Application Development at UDayton-CS • How to develop application software with “Building Security In” Approach  Secure and Sustainability Principles and Practices in Application Development Robust and Defensive Programming Techniques Avoid security problems at the design stage o Developers with hacker mindset!! 35
  • 37. Secure Application Development Example: A Simple Login System •Code (from the scratch) to authenticate users with username/password Check on real database (MySQL) •Then think as a hacker!  Doing self-attacks  Implementing secure code The query: SELECT * FROM users where username='admin' AND password=password('thepassword'); thepassword 36
  • 38. Username/password check from Database 37 Discussion: What are the potential security risks in this SQL statement? A. No input validation B. Attackers can inject SQL code C. Attackers can inject JavaScript code D. A and B E. A, B, and C sql=SELECT * FROM users where username=' ' AND password=password(' ') P4$$w0rd admin P4$$w0rd
  • 39. Self-attack Demo: Mixed SQL and JavaScript 38 admin' #<script>alert(document.cookie)</script> This is an example of code injection attacks, mixing SQL and JavaScript. Will be covered in detail next steps
  • 40. Prepared Statements in PHP/MySQL 39 Vulnerable SQL Statement OWASP Primary Defenses against SQL Injection Attacks: Option #1: Use of Prepared Statements
  • 41. Built-in Security Mindfulness for Software Developers at UDayton-CS: A Reflection •Stable and increasing enrollment •Very high positive feedback from students Yoursecureapplication projectis veryusefulforattending interviews. Dr.Phung, Ijust wantedtothankyouandalsoletyouknowhowbeneficial yourclass wasinan interviewIhadacoupleweeksago. … Yourclassbenefited meextremelyandIjustwantedtomakesurethatyouknewand yousothatyoucantellyourclasses what employersmightaskabout.Iendedup gettingajoboffer15minutes afterIleft theinterview,theysaidthattheywere trulyimpressed with myrangeofknowledge. 40
  • 42. Challenges and Opportunities •Security courses are not mandatory for CS students  Future developers still write insecure code !!! •I welcome and look forward to opportunities  Integrate security components in programming classes  Collaborate with other colleges to explore the possibilities to integrate security components in their curriculum  Work with industry to propose a long-term solution 41
  • 43. Thank you! Phu H. Phung Intelligent Systems Security Lab Department of Computer Science, University of Dayton https://isseclab-udayton.github.io/ March 11, 2020

Editor's Notes

  • #16: https://youtu.be/M_IIbjBtHLY
  • #21: WannaCry attacks
  • #32: http://myphoto.blog.com/cat.php?id=1 UNION SELECT 1, 2, 3, 4
  • #33: http://myphoto.blog.com/cat.php?id=1 UNION SELECT 1, 2, 3, 4
  • #35: E. 4 http://myphoto.blog.com/cat.php?id=1 UNION SELECT 1, 2, 3, 4 http://myphoto.blog.com/cat.php?id=1 UNION SELECT 1, 'pphung1', 3, 4
  • #39: E. All are correct
  • #41: $prepared_sql = "SELECT * FROM users WHERE username= ? " . " AND password=password(?);"; if(!$stmt = $mysqli->prepare($prepared_sql)) echo "Prepared Statement Error"; $stmt->bind_param("ss", $username,$password); if(!$stmt->execute()) echo "Execute Error"; if(!$stmt->store_result()) echo "Store_result Error"; $result = $stmt;