SlideShare a Scribd company logo
Securing Applications A Practical Primer for Developers Burak Dayıoğlu Your security, your future
About the presenter
Application Security Today BJ's Settles Case with FTC over Customer Data JUNE 17, 2005 -- After credit card data for thousands of customers was used to make fraudulent purchases in other stores, BJ's Wholesale Club Inc. has agreed FTC alleges weak security at wholesale club led to fraudulent sales valued in the millions July 19, 2005 -- Visa USA Inc. and American Express Co. are cutting ties with the payment-processing company that left 40 million credit and debit card accounts vulnerable to hackers in one of the biggest breaches of  consumer data Visa, Amex Cut Ties with CardSystems Jan 18, 2007 Massive Security Breach Reveals Credit Card Data The TJX Companies, a large retailer that operates more than 2,000 retail stores under brands such as Bob’s Stores, HomeGoods, Marshalls, T.J. Maxx and A.J. Wright, said on Wednesday that it suffered a massive computer breach on a portion of its network that handles credit card, debit card, check and merchandise transactions in the United States and abroad. CNBC's Easy Money BusinessWeek  uncovers that the cable channel's own design flaw may be behind the investigation into its million-dollar stock-picking contest  USDA admits data breach, thousands of social security numbers revealed Thursday, 17 April 2007  (AXcess News) Washington - The US Department of Agriculture (USDA) admitted that a security breach allowed social security and other personal information of over 63,000 recipients of federal farm loans be made available on a public website in violation of Federal privacy laws.
Holistic Approach to Security Port blocking Filtering Encryption Updates IIS hardening ACLs CAS Logging Least privilege Account mgmt. Validation Hashing Encryption Secrets mgmt. Cookie mgmt. Session mgmt. Error handling Spoofed packets, etc. Buffer overflows, illicit paths, etc.  SQL injection, XSS, input tampering, etc. Network Host Application Defend the network Defend the host Defend the application
Hacking with Google
Security in the Development Lifecycle Requirements Assessment Design Complete Test Plans Complete Code Complete Ship Post Ship Applying Security Patterns External Review Development Team Training Security Testing Secure Programming Techniques Source Code Reviews Static Analysis Tools Review Check-Ins Penetration Test Learn and Improve External Review and/or Test Threat Modeling Support and Incident Response Assessing Security Requirements Use of Design Principles Inspecting Previous Vulnerabilities
Guiding Design Principles Secure the weakest link Practice defense in depth Fail securely Follow the principle   of least privilege Compartmentalize Keep it simple Remember that hiding secrets is hard Be reluctant to trust
Attack Surface Reduction (ASR) A system's  attack surface  is the set of ways in which an attacker can enter and potentially cause damage to the system T he measure of a system's attack surface  is  an indication of the system's security T he larger the attack surface, the more insecure the system
Reducing the Attack Surface Reduce the amount of running code 80 %  of your users  actually   use the functionality? If not,  turn it off Reduce entry points If you can do the same with less ports, sockets, service entry points etc., then just do it Reduce  a ccess to  e ntry  p oints by  u ntrusted  u sers Restrict access to network endpoints used by your application to the local subnet or IP range
Input Validation All data coming from  untrusted  sources should be validated before being processed It might be possible to tamper application flow and/or behaviour with invalid data What you can trust depends on the application context Users Applications on same host Shared libraries (.so, .dll etc.) OS interfaces Other modules in the same app.
Blacklisting is “Bad” Endless security issues with PHF (mid 1990’s) Command injection (improper input validation) Fix through blacklisting Command injection, round 2 (in just two days) Fix through blacklisting Command injection, round 2 (in just another day) Fix through whitelisting (Problem solved) Command injection, SQL injection, LDAP injection etc.
Sample SQL Injection Sample vulnerable code fragment When  criteria  is SECURITY When criteria is “’; DELETE FROM news--” $query = “SELECT title FROM news WHERE body LIKE ‘%” . $criteria . ”%’”; SELECT title FROM news  WHERE body LIKE ‘%SECURITY%’ SELECT title FROM news  WHERE body LIKE ‘% ’; DELETE FROM  news -- %’
What would be the Query? Select * from users where username  = “ _1_ ” and  password  = “ _2_ ”;
Cross-Site Scripting (XSS) /location=<script>document.images[4].src= &quot;http://www.badsite.com/news.jpg&quot;</script>
Web is just a messaging protocol
HTML Form Tampering <FORM METHOD=POST ACTION=&quot;/ pb/phonebook . php &quot;> < INPUT  type=&quot;hidden&quot; name=&quot;sessionID&quot; value=” ad757gj02m357 ”> < INPUT  type=&quot;hidden&quot; name=“ username &quot; value=” pinguin ”> < INPUT  type=&quot;submit&quot; name=“ Retrieve Entries &quot;> </ FORM >  1 <INPUT TYPE=text NAME=phonenumber MAXLENGTH=30> 2 <INPUT TYPE=“radio” NAME=“agegroup” VALUE=“young”> <INPUT TYPE=“radio” NAME=“agegroup” VALUE=“middle”> <INPUT TYPE=“radio” NAME=“agegroup” VALUE=“old”> 3 <SELECT NAME=“langs”> <OPTION VALUE=PHP>Personal Home Page</OPTION> <OPTION VALUE=ASP>Active Server Pages</OPTION> </SELECT> 4
Validating Form Data in Browser Client side validations can be bypassed or tampered <HTML> <HEAD><TITLE> Client Side  Val idation Example </TITLE> <SCRIPT LANG=&quot;Javascript1.2&quot;> <!-- function  checkmail () { regexp mail  = /^[a-z0-9_\-\.]+\@([a-z0-9_\-]+\.)+[a-z0-9_\-]+$/ ; stre mail  = document. my form.e mail .value; result  = stre mail . match (regexp mail ); if ( !result ) { alert (“ Address information not valid, pls try again &quot;); return false; } return true; } //--> </SCRIPT></HEAD><BODY> <FORM NAME= my form ONSUBMIT=&quot;return  checkmail ()&quot;> <INPUT TYPE=text NAME=e mail  MAZLENGTH=50><INPUT TYPE=submit VALUE=“ Submit &quot;> </FORM> </BODY></HTML>
Error Messages Error messages might reveal sensitive information to a potential attacker Portions of an SQL statement Error message that includes brand/version of database or directory server Error message for a file that doesn’t open up … Handle all failure cases that you can foresee, configure the environment to log (and not display) verbose error messages
Filesystem Operations and Security Any component that operates on files is of high risk If input validation is broken somehow Arbitrary files might be read Arbitrary files might be overwritten Arbitrary files might be uploaded & executed Beware critical symbols for filesystem objects and the OS shell .  ..  &&  ||  >  <  * ;  null  (%00)
Easy to Guess Files and Directories There are things to discover by just educated guessing /CVS /admin /test README INSTALL backup.zip
Backup Files Would one of them be left somewhere? mycode.jsp~ mycode.jsp.OLD mycode.jsp.ORIG mycode.jsp.BACK mycode.jsp.BAK
Directory Listings Directory listings should be turned-off for all servers/sites
Thank you! [email_address] Twitter: dayioglu  FriendFeed: dayioglu http://www.burakdayioglu.net Your security, your future

More Related Content

PPT
Web Application Security
PPT
Web Application Security - "In theory and practice"
PPTX
Exploiting parameter tempering attack in web application
PPTX
Parameter tampering
PPTX
A10 - Unvalidated Redirects and Forwards
PDF
Security Awareness
PDF
Point-Of-Sale Hacking - 2600Thailand#20
PPTX
Analysis of web application penetration testing
Web Application Security
Web Application Security - "In theory and practice"
Exploiting parameter tempering attack in web application
Parameter tampering
A10 - Unvalidated Redirects and Forwards
Security Awareness
Point-Of-Sale Hacking - 2600Thailand#20
Analysis of web application penetration testing

What's hot (20)

PDF
A security note for web developers
PPTX
How AppTrana helps Protect Against OWASP Top 10 Vulnerabilities
PPT
Security 101
PPT
Owasp top 10 & Web vulnerabilities
PPT
Step by step guide for web application security testing
PPT
Get Ready for Web Application Security Testing
PPT
Introduction to Web Application Penetration Testing
PDF
Session4-Authentication
PPTX
Sql injection
PDF
Session3 data-validation-sql injection
PDF
OWASP Top 10 Mobile Risks
PDF
Session2-Application Threat Modeling
PPTX
SQL injection
PDF
OWASP Top 10
PDF
C01461422
PDF
S5-Authorization
PPTX
Web Server Web Site Security
PPTX
Why Two-Factor Isn't Enough
PDF
S8-Session Managment
PDF
OWASP Top 10 (2010 release candidate 1)
A security note for web developers
How AppTrana helps Protect Against OWASP Top 10 Vulnerabilities
Security 101
Owasp top 10 & Web vulnerabilities
Step by step guide for web application security testing
Get Ready for Web Application Security Testing
Introduction to Web Application Penetration Testing
Session4-Authentication
Sql injection
Session3 data-validation-sql injection
OWASP Top 10 Mobile Risks
Session2-Application Threat Modeling
SQL injection
OWASP Top 10
C01461422
S5-Authorization
Web Server Web Site Security
Why Two-Factor Isn't Enough
S8-Session Managment
OWASP Top 10 (2010 release candidate 1)
Ad

Similar to Securing Applications (20)

PPT
Defcon9 Presentation2001
PPT
Application Security
PPT
Owasp Top 10 - Owasp Pune Chapter - January 2008
PPT
Writing Secure Code – Threat Defense
PPT
Web Application Security
PPTX
Threat Modeling - Writing Secure Code
PPT
Web Application Security and Release of "WhiteHat Arsenal"
PPTX
Easy security presentation 1
PPT
Intro to Web Application Security
PPT
Developing Secure Applications and Defending Against Common Attacks
PPTX
Web Application Penetration Testing Introduction
PPT
Application Security
PDF
Based on the below and using the 12 categories of threats identify 3 .pdf
PPT
Discovering the Value of Verifying Web Application Security Using IBM Rationa...
PPT
Php & Web Security - PHPXperts 2009
PPT
Network security
PPTX
Application and Website Security -- Fundamental Edition
PPT
Jan 2008 Allup
PPT
StartPad Countdown 2 - Startup Security: Hacking and Compliance in a Web 2.0 ...
ODP
OWASP Secure Coding
Defcon9 Presentation2001
Application Security
Owasp Top 10 - Owasp Pune Chapter - January 2008
Writing Secure Code – Threat Defense
Web Application Security
Threat Modeling - Writing Secure Code
Web Application Security and Release of "WhiteHat Arsenal"
Easy security presentation 1
Intro to Web Application Security
Developing Secure Applications and Defending Against Common Attacks
Web Application Penetration Testing Introduction
Application Security
Based on the below and using the 12 categories of threats identify 3 .pdf
Discovering the Value of Verifying Web Application Security Using IBM Rationa...
Php & Web Security - PHPXperts 2009
Network security
Application and Website Security -- Fundamental Edition
Jan 2008 Allup
StartPad Countdown 2 - Startup Security: Hacking and Compliance in a Web 2.0 ...
OWASP Secure Coding
Ad

More from Burak DAYIOGLU (6)

PPT
Log Yönetiminin Artan Önemi
PPT
Windows Masaüstü Güvenliği
PPT
Açık Kaynak Kodu ve Güvenlik
PPT
Linux Guvenligi V1.0
PPT
Yeni Kuşak Güvenlik Tehditleri
PPT
Redefining Endpoint Security
Log Yönetiminin Artan Önemi
Windows Masaüstü Güvenliği
Açık Kaynak Kodu ve Güvenlik
Linux Guvenligi V1.0
Yeni Kuşak Güvenlik Tehditleri
Redefining Endpoint Security

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
A Presentation on Artificial Intelligence
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation theory and applications.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
Machine learning based COVID-19 study performance prediction
Chapter 3 Spatial Domain Image Processing.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
A Presentation on Artificial Intelligence
MYSQL Presentation for SQL database connectivity
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Diabetes mellitus diagnosis method based random forest with bat algorithm
20250228 LYD VKU AI Blended-Learning.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Modernizing your data center with Dell and AMD
Electronic commerce courselecture one. Pdf
Encapsulation theory and applications.pdf
Big Data Technologies - Introduction.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation

Securing Applications

  • 1. Securing Applications A Practical Primer for Developers Burak Dayıoğlu Your security, your future
  • 3. Application Security Today BJ's Settles Case with FTC over Customer Data JUNE 17, 2005 -- After credit card data for thousands of customers was used to make fraudulent purchases in other stores, BJ's Wholesale Club Inc. has agreed FTC alleges weak security at wholesale club led to fraudulent sales valued in the millions July 19, 2005 -- Visa USA Inc. and American Express Co. are cutting ties with the payment-processing company that left 40 million credit and debit card accounts vulnerable to hackers in one of the biggest breaches of consumer data Visa, Amex Cut Ties with CardSystems Jan 18, 2007 Massive Security Breach Reveals Credit Card Data The TJX Companies, a large retailer that operates more than 2,000 retail stores under brands such as Bob’s Stores, HomeGoods, Marshalls, T.J. Maxx and A.J. Wright, said on Wednesday that it suffered a massive computer breach on a portion of its network that handles credit card, debit card, check and merchandise transactions in the United States and abroad. CNBC's Easy Money BusinessWeek uncovers that the cable channel's own design flaw may be behind the investigation into its million-dollar stock-picking contest USDA admits data breach, thousands of social security numbers revealed Thursday, 17 April 2007 (AXcess News) Washington - The US Department of Agriculture (USDA) admitted that a security breach allowed social security and other personal information of over 63,000 recipients of federal farm loans be made available on a public website in violation of Federal privacy laws.
  • 4. Holistic Approach to Security Port blocking Filtering Encryption Updates IIS hardening ACLs CAS Logging Least privilege Account mgmt. Validation Hashing Encryption Secrets mgmt. Cookie mgmt. Session mgmt. Error handling Spoofed packets, etc. Buffer overflows, illicit paths, etc. SQL injection, XSS, input tampering, etc. Network Host Application Defend the network Defend the host Defend the application
  • 6. Security in the Development Lifecycle Requirements Assessment Design Complete Test Plans Complete Code Complete Ship Post Ship Applying Security Patterns External Review Development Team Training Security Testing Secure Programming Techniques Source Code Reviews Static Analysis Tools Review Check-Ins Penetration Test Learn and Improve External Review and/or Test Threat Modeling Support and Incident Response Assessing Security Requirements Use of Design Principles Inspecting Previous Vulnerabilities
  • 7. Guiding Design Principles Secure the weakest link Practice defense in depth Fail securely Follow the principle of least privilege Compartmentalize Keep it simple Remember that hiding secrets is hard Be reluctant to trust
  • 8. Attack Surface Reduction (ASR) A system's attack surface is the set of ways in which an attacker can enter and potentially cause damage to the system T he measure of a system's attack surface is an indication of the system's security T he larger the attack surface, the more insecure the system
  • 9. Reducing the Attack Surface Reduce the amount of running code 80 % of your users actually use the functionality? If not, turn it off Reduce entry points If you can do the same with less ports, sockets, service entry points etc., then just do it Reduce a ccess to e ntry p oints by u ntrusted u sers Restrict access to network endpoints used by your application to the local subnet or IP range
  • 10. Input Validation All data coming from untrusted sources should be validated before being processed It might be possible to tamper application flow and/or behaviour with invalid data What you can trust depends on the application context Users Applications on same host Shared libraries (.so, .dll etc.) OS interfaces Other modules in the same app.
  • 11. Blacklisting is “Bad” Endless security issues with PHF (mid 1990’s) Command injection (improper input validation) Fix through blacklisting Command injection, round 2 (in just two days) Fix through blacklisting Command injection, round 2 (in just another day) Fix through whitelisting (Problem solved) Command injection, SQL injection, LDAP injection etc.
  • 12. Sample SQL Injection Sample vulnerable code fragment When criteria is SECURITY When criteria is “’; DELETE FROM news--” $query = “SELECT title FROM news WHERE body LIKE ‘%” . $criteria . ”%’”; SELECT title FROM news WHERE body LIKE ‘%SECURITY%’ SELECT title FROM news WHERE body LIKE ‘% ’; DELETE FROM news -- %’
  • 13. What would be the Query? Select * from users where username = “ _1_ ” and password = “ _2_ ”;
  • 14. Cross-Site Scripting (XSS) /location=<script>document.images[4].src= &quot;http://www.badsite.com/news.jpg&quot;</script>
  • 15. Web is just a messaging protocol
  • 16. HTML Form Tampering <FORM METHOD=POST ACTION=&quot;/ pb/phonebook . php &quot;> < INPUT type=&quot;hidden&quot; name=&quot;sessionID&quot; value=” ad757gj02m357 ”> < INPUT type=&quot;hidden&quot; name=“ username &quot; value=” pinguin ”> < INPUT type=&quot;submit&quot; name=“ Retrieve Entries &quot;> </ FORM > 1 <INPUT TYPE=text NAME=phonenumber MAXLENGTH=30> 2 <INPUT TYPE=“radio” NAME=“agegroup” VALUE=“young”> <INPUT TYPE=“radio” NAME=“agegroup” VALUE=“middle”> <INPUT TYPE=“radio” NAME=“agegroup” VALUE=“old”> 3 <SELECT NAME=“langs”> <OPTION VALUE=PHP>Personal Home Page</OPTION> <OPTION VALUE=ASP>Active Server Pages</OPTION> </SELECT> 4
  • 17. Validating Form Data in Browser Client side validations can be bypassed or tampered <HTML> <HEAD><TITLE> Client Side Val idation Example </TITLE> <SCRIPT LANG=&quot;Javascript1.2&quot;> <!-- function checkmail () { regexp mail = /^[a-z0-9_\-\.]+\@([a-z0-9_\-]+\.)+[a-z0-9_\-]+$/ ; stre mail = document. my form.e mail .value; result = stre mail . match (regexp mail ); if ( !result ) { alert (“ Address information not valid, pls try again &quot;); return false; } return true; } //--> </SCRIPT></HEAD><BODY> <FORM NAME= my form ONSUBMIT=&quot;return checkmail ()&quot;> <INPUT TYPE=text NAME=e mail MAZLENGTH=50><INPUT TYPE=submit VALUE=“ Submit &quot;> </FORM> </BODY></HTML>
  • 18. Error Messages Error messages might reveal sensitive information to a potential attacker Portions of an SQL statement Error message that includes brand/version of database or directory server Error message for a file that doesn’t open up … Handle all failure cases that you can foresee, configure the environment to log (and not display) verbose error messages
  • 19. Filesystem Operations and Security Any component that operates on files is of high risk If input validation is broken somehow Arbitrary files might be read Arbitrary files might be overwritten Arbitrary files might be uploaded & executed Beware critical symbols for filesystem objects and the OS shell . .. && || > < * ; null (%00)
  • 20. Easy to Guess Files and Directories There are things to discover by just educated guessing /CVS /admin /test README INSTALL backup.zip
  • 21. Backup Files Would one of them be left somewhere? mycode.jsp~ mycode.jsp.OLD mycode.jsp.ORIG mycode.jsp.BACK mycode.jsp.BAK
  • 22. Directory Listings Directory listings should be turned-off for all servers/sites
  • 23. Thank you! [email_address] Twitter: dayioglu FriendFeed: dayioglu http://www.burakdayioglu.net Your security, your future