Web Application Security Kitisak Jirawannakool Electronics Government Agency (Public Organization) 1
สำนักงานพัฒนารัฐบาลดิจิทัล
เนื้อหา
หน้า 1
Web Application Security Kitisak Jirawannakool Electronics Government Agency (Public Organization) 1
หน้า 2
Agenda ❖ What is Security? ❖ Web Application Security ❖ Real cases ❖ Securing CMS tactics ❖ Web Application Security Testing 2
หน้า 3
What is Security? ❖ C (Confidentiality) ❖ I (Integrity) ❖ A (Availability) 3
หน้า 4
4
หน้า 5
Security Myths : We are not a target ❖ “Mostly I hear it from victims. They think they aren’t worth hacking. Some say it’s not worthwhile because they're a small business – not on anybody’s radar. Others contend they don’t collect Social Security numbers, credit card data or other ‘valuable’ information. They are usually wrong.” Alan Brill, senior managing director for the cybersecurity and information assurance practice at Kroll 5
หน้า 6
What is Secure Software? 6 It’s secure! Looks at the lock, up on the left ! It’s secure! It’s Google! Sure! The news said that is unbreakable!
หน้า 7
Software Security Principles ❖ Security vulnerabilities in the software development process are expected. ❖ The control of the security bugs and flaws in the software should be considered as part of the process of software development. ❖ Vulnerability management (fixing process) is the most important step of the process of software security. 7
หน้า 8
Web Architecture Components 8 Reference :: Web Application Hacking/Security 101 ( https://docs.google.com/presentation/d/1fw7fO7kmVTcfXuupGTezSM76cdQH3IbYos5xu95LyMs/edit#slide=id.p ) FIREWALL Database Authentication Service Access Control Web Service Web Server
หน้า 9
Web Architecture Attacks 9 Reference :: Web Application Hacking/Security 101 ( https://docs.google.com/presentation/d/1fw7fO7kmVTcfXuupGTezSM76cdQH3IbYos5xu95LyMs/edit#slide=id.p ) Database FIREWALL Authentication Service Access Control Web Service Web Server Click jacking XSS CSRF Packet Sniffing Parameter Tampering Forged Tokens Direct Object Reference SQL injection Directory Traversal XML Injection
หน้า 10
Hack for ? ❖ Defacing website ❖ http://www.zone-h.org ❖ Phishing ❖ Spreading malware ❖ Making money ❖ Discrediting opposite ❖ Fun ❖ State sponsor 10
หน้า 11
Hot topic!!!!!! 11
หน้า 12
Web Attacking ❖ Web Defacement ❖ Malicious script spreading ❖ Phishing ❖ Database and Credential stolen 12
หน้า 13
Review: web app security ❖ Lack of security awareness ❖ A lot of misunderstanding ❖ Network firewall can also protect web applications ❖ Security is only network security and ISO standard ❖ Lack of secure coding skills ❖ Need web application firewall implemented ❖ Need web application audit 13
หน้า 14
Why we need web application security? 14
หน้า 15
Network Security is not enough ❖ Network Security Mostly Ignores the Contents of HTTP Traffic, such as.... ❖ Firewalls, SSL, Intrusion Detection Systems ❖ Operating System Hardening, Database Hardening ❖ Need to secure web application (Not Network Security) ❖ Securing the “custom code” that drives a web application ❖ Securing libraries ❖ Securing backend systems ❖ Securing web and application servers ❖ Cloud Computing is coming, the infrastructure is secured by the provider but we are still need to secure our application . 15
หน้า 16
OWASP ❖ Open Web Application Security Project ❖ http://www.owasp.org ❖ Open group focused on understanding and improving the security of web applications and web services! ❖ Hundreds of volunteer experts from around the world 16
หน้า 17
Open Web Application Security Project 17
หน้า 18
OWASP Top 10 2013 ❖ Injection ❖ Broken Authentication and Session Management ❖ Cross-Site Scripting(XSS) ❖ Insecure Direct Object Refer ence ❖ Security Misconfiguration ❖ Sensitive Data Exposure ❖ Missing Function Level Access Control ❖ Cross-Site Request Forgery(CSRF) ❖ Using Components with Known Vulnerability ❖ Unvalidated Redirects and Forwards 18
หน้า 19
Answer these questions ❖ How many websites do you have? ❖ Did you develop by yourself? ❖ If Yes, ❖ Did you use CMS or coding by yourself? ❖ If No, ❖ Who did? Can you control them? ❖ Is there login page on your website? ❖ Do you use HTTPS? ❖ Have you ever updated your servers and apps? 19
หน้า 20
How to attack our servers? ❖ Systems ❖ OS ❖ Software installed ❖ Network ❖ Sniffer ❖ Spoofing ❖ Flooding / DDoS ❖ Applications ❖ Data ❖ Operation 20
หน้า 21
Security components 21
หน้า 22
General Attack Lifecycle 22 Profiling Entering Empowering Compromising Concealing
หน้า 23
Security by Obscurity 23
หน้า 24
Information Leakage ❖ Remove from OWASP Top 10 vulnerabilities ❖ Information Leakage ❖ Application internals, environment information ❖ Reduce the effort to launch a successful attack ❖ Results in more targeted attacks ❖ Security by obscurity ❖ Insufficient to properly secure applications ❖ Increases the effort for an attacker ❖ Increases chances of detecting attack patterns ❖ General advice: Do not expose information that doesn’t need to be exposed 24
หน้า 25
Exercises ❖ Access your organization’s website ❖ What information do you disclose unnecessarily? ❖ How could that information be used in an attack? 25
หน้า 26
Security culture 26
หน้า 27
Building security and compliance into the SDLC 27 196 ©2012 IBM Corporation 196 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Building security and compliance into the SDLC Build Developers SDLC Developers Developers Coding QA Security Production Enable Security to effectively drive remediation into development Provide developers and testers with expertise on detection and remediation ability Ensure vulnerabilities are addressed before applications are put into production
หน้า 28
Why people choose not to build secure systems 28
หน้า 29
Selling security to the organisation 29 198 ©2012 IBM Corporation 198 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Selling security to the organization Secure products are quality products If your company doesn't care about creating quality products, find a job elsewhere. But: It's not that simple, there is no perfect security. The media (and your competition) leap on security issues Security vulnerabilities are expensive to fix. Source: Michael Howard, David LeBlank, Writing Secu re Code, Microsoft Press 2003
หน้า 30
Security vulnerabilities are expensive to fix 30 199 ©2012 IBM Corporation 199 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Security vulnerabilities are expensive to fix A basic survey of software companies that have esta blished practices for fixing vulnerabilities that lead to attacks approximate th at the costs associated with remediating a Web site that has encountered an XSS- like attack is around 40 man-hours per incident . That cost combined with the cost of hiring or train ing an engineer to address the problem (~USD 100/hour) and the average number of s even XSS (or similar) exploitable vulnerabilities per Web site brings the total estimated cost to USD 28,000 to fix each problem reactively. Security breaches can be much more expensive . This figure does not account for the impact to online business transactions, custome r satisfaction issues, or other potential risks (compensation for damages, fines) a ssociated with a business' Web site being vulnerable to hijacking, phishing, o r defacement. Source: Microsoft SDL Quick Security Reference - Cro ss-Site Scripting, http://www.microsoft.com/downloa d/en/details.aspx?id=13759
หน้า 31
Raising security awareness : Never waste a crisis 31 200 ©2012 IBM Corporation 200 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Raising security awareness: Never waste a crisis “It seems that all security practitioners struggle with the same predicament: How do I get the software engineering teams to wake up and start taking software security seriously? One of the most effective ways to achieve rapid, dramatic change is to leverage a crisis.” –Brad Arkin, Adobe Systems Source: Brad Arkin, “Never Waste a Crisis”, IEEE Se curity and Privacy, vol. 9, no. 3, pp. 82-85, May-J une 2011, doi:10.1109/MSP.2011.58
หน้า 32
Advise for security champions in normal times 32 201 ©2012 IBM Corporation 201 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Advise for security champions in normal times Fight the good fight –Be persistent (but not annoying) –Build allies in the team –Deliver data-driven arguments and appeals for reso urces –Play within the bounds of what process and culture allow Build your network throughout the company (Legal, S ales, Marketing, PR, executive management) Build your social network Have a continually refreshed plan how to respond to crisis –Understand the business –Plan scenarios based on real security failures –Develop a magic-wand plan: “In a world of unlimite d resources, we should do X, Y, and Z” Develop metrics Source: Brad Arkin, “Never Waste a Crisis”, IEEE Se curity and Privacy, vol. 9, no. 3, pp. 82-85, May-J une 2011, doi:10.1109/MSP.2011.58
หน้า 33
Advise for security champions during a crisis 33 202 ©2012 IBM Corporation 202 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Advise for security champions during a crisis Step 1: Speak their language –Start with the facts –Let go of the detail –Convert what you know into the language of your co unterparts –Provide clear recommendations Step 2: Implement the magic-wand plan –Link recommendations and crisis –Group recommendations in people, process, technolo gy –Example: Develop rapid-response capabilities, intr oduce automated security testing Step 3: Be ready to scale –Drive long-term culture change –Define proven processes, security road map and hea lthy metrics Source: Brad Arkin, “Never Waste a Crisis”, IEEE Se curity and Privacy, vol. 9, no. 3, pp. 82-85, May-J une 2011, doi:10.1109/MSP.2011.58
หน้า 34
203 ©2012 IBM Corporation 203 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia Security education Foundation for culture change IT departments –System administrators –Architects/designers –Developers –Testers But also –Helpdesk staff –Business owners –Legal department –Executive management And also –Employees –Customers –Partners –Suppliers –not just for the IT department Security education is not for only IT guys 34
หน้า 35
General recommendations 35 208 ©2012 IBM Corporation 208 OWASP AppSec Asia Pacific 2012 | April 11-14, 20 12 | Sydney, Australia General recommendations Define application security requirements –Consider security aspects at every stage of the pr oject –Threat modeling (threat agents, technical and busi ness impact) –Include security test cases and ethical hacking –Security is not a nice-to-have Design applications with a focus on end-to-end secu rity –Use security products during development, testing and running applications –Use proven libraries and frameworks (and keep them up to date!) –Do not rely on network or middleware layers to pro vide security –Think like a hacker (but don’t become one :-)) –“What could go wrong?” Define process for dealing with security exposures and incidents –Follow security advisories –Action plan, e.g. shutdown server, shutdown applic ation –Communication plan, e.g. inform affected parties, team leader, executive management
หน้า 36
Risk management 36
หน้า 37
Requirements ❖ People ❖ Stakeholders ❖ Implementors, managers, admins, data owners and users ❖ Process ❖ Business processes, policies and procedures ❖ Input and output ❖ Data storage and database ❖ Technology ❖ Network, system and application 37
หน้า 38
Design (1/2) ❖ Network infrastructure ❖ Cloud, data center or hosting ❖ System used ❖ Operating System ❖ Softwares or applications ❖ Web and Database Servers, Middleware ❖ Other tools 38
หน้า 39
Design (2/2) ❖ Application development ❖ CMS or own developing (partial or all) ❖ Language ❖ Database design ❖ Data protection ❖ Operation 39
หน้า 40
Implementation ❖ Development phase ❖ Secure coding ❖ Production phase (Go live) ❖ OS hardening ❖ Operation ❖ Backup and recovery 40
หน้า 41
Te s t i n g ❖ Software testing ❖ Vulnerability Assessment ❖ Penetration Testing ❖ Monitoring ❖ Log and system ❖ Information ❖ Audit 41
หน้า 42
Why hackers love your CMS? ❖ Do you still use Joomla version 1.5 or older? ❖ Do you use default setting/configuration? ❖ Do you install unnecessary modules? ❖ Is your admin’s password easy to guess? ❖ If you answer “Yes”, you are vulnerable ❖ Because exploit code are published (easy to find) ❖ You can watch the hacking methods on Youtube 42
หน้า 43
If you use CMS, you must ...... ❖ Get Security Announcements ❖ Choose an active CMS ❖ Upgrade (Forever) ❖ Choose plugins/modules wisely ❖ Back up early and often ❖ Secure your host ❖ Use the community 43
หน้า 44
Hardening ❖ Reduce attack surfaces ❖ Best suite a newly implemented server before migrating to production ❖ During production, follow risk assessment reports to add more security ❖ Both OS and Application 44
หน้า 45
OS Hardening Concept § Harden Installation : Install package that you want to use. § Patch and Latest OS § Backup and Image § Time Synchronization § Secure Service : Open Port and Service as you want to serve. Port scan checking § Network Access Control: Firewall § Secure User : User Management, Segregate or Duty. 45
หน้า 46
OS Hardening Concept[2] § Secure File and Data : File permission, Owner Control, File integrity checker. § Harden Kernel § Secure Administrator communication § System logging § System Monitoring § Antivirus/AntiMalware 46
หน้า 47
Important Main Points ❖ Update security patches ❖ Disable unnecessary functions ❖ Least privilege/access ❖ Appropriate authentication ❖ Enable monitoring capabilities ❖ Secure communications 47
หน้า 48
Conclusion - Defense in Depth § Using a layered approach: – Increases an attacker’s risk of detection – Reduces an attacker’s chance of success 48 Policies, Procedures, & Awareness OS hardening, patch management, authentication, Host-based IDS Firewalls, VPN quarantine Guards, locks, tracking devices Network segments, IPSec, Network- based IDS, IPS Application hardening, antivirus Access Control ,Encryption User education, Policy Physical Security Perimeter Internal Network Host Application Data
หน้า 49
Web Application Security Testing 49
หน้า 50
Software Testing Functional testing vs Security testing 50
หน้า 51
OWASP Testing Guide v.4.0 ❖ Most comprehensive open source secure testing guide on the web ❖ Years of development effort ❖ Version 4.0 produced 2014 ❖ Hundred of contributors ❖ Project Leader and Editor ❖ Matteo Meucci, Andrew Muller ❖ www.owasp.org/index.php/Testing_Guide 51
หน้า 52
OTG v4 Index 1. Frontispiece 2. Introduction 3. The OWASP Testing Framework 4. Web Application Penetration Testing 5. Writing Reports: value the real risk Appendix A: Testing Tools Appendix B: Suggested Reading Appendix C: Fuzz Vectors Appendix D: Encoded Injection 52
หน้า 53
Automated Vulner. Scanning tools ❖ OWASP Zed Attack Proxy (ZAP) ❖ Burp suite ❖ w3af ❖ Acunatix ❖ Nessus ❖ ..... 53
หน้า 54
An Introduction to ZAP The OWASP Zed Attack Proxy 54
หน้า 55
The Introduction ❖ The statement ❖ You cannot build secure web applications unless you know how to attack them ❖ The problem ❖ For many developers ‘penetration testing’ is a black art ❖ The solution ❖ Te a c h b a s i c p e n t e s t i n g techniques to developers 55 ❖ Thanks to Royston Robertson www.roystonrobertson.co.uk for permission to use his cartoon!
หน้า 56
The Caveat ❖ This is in addition to: ❖ Teaching secure coding techniques ❖ Teaching about common vulnerabilities (e.g. OWASP top 10) ❖ Secure Development Software Lifecycle ❖ Static source code analysis ❖ Code reviews ❖ Professional pentesting ❖ ... 56
หน้า 57
The Zed Attack Proxy ❖ Released September 2010 ❖ Ease of use a priority ❖ Comprehensive help pages ❖ Free, Open source ❖ Cross platform ❖ A fork of the well regarded Paros Proxy ❖ Involvement actively encouraged ❖ Adopted by OWASP October 2010 57
หน้า 58
More about ZAP ❖ Project Leader ❖ Simon Bennet, UK ❖ Download from ❖ https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project 58
หน้า 59
ZAP Principles ❖ Free, Open source ❖ Cross platform ❖ Easy to use ❖ Easy to install ❖ Internationalised ❖ Fully documented ❖ Involvement actively encouraged ❖ Reuse well regarded components 59
หน้า 60
The Main Features ❖ All the essentials for web application testing ❖ Intercepting Proxy ❖ Active and Passive Scanners ❖ Spider ❖ Report Generation ❖ Brute Force (using OWASP DirBuster code) ❖ Fuzzing (using OWASP JBroFuzz code) 60
หน้า 61
T he Additional Features ❖ Auto tagging ❖ Port scanner ❖ Smart card support ❖ Session comparison ❖ Invoke external apps ❖ BeanShell integration ❖ API + Headless mode ❖ Dynamic SSL Certificates ❖ Anti CSRF token handling 61
หน้า 62
The Demo 62
หน้า 63
Summary and Conclusion 1 ❖ ZAP is: ❖ Easy to use (for a web app pentest tool;) ❖ Ideal for appsec newcomers ❖ Ideal for training courses ❖ Being used by Professional Pen Testers ❖ Easy to contribute to (and please do!) ❖ Improving rapidly 63
หน้า 64
Summary and Conclusion 2 ❖ ZAP has: ❖ An active development community ❖ An international user base ❖ The potential to reach people new to OWASP and appsec, especially developers and functional testers ❖ ZAP is a key OWASP project 64
หน้า 65
Thank you. 65
ข้อความถอดจากไฟล์ต้นฉบับโดยอัตโนมัติ อาจมีข้อผิดพลาด โปรดยึดต้นฉบับของหน่วยงาน