SlideShare uma empresa Scribd logo
1 de 26
Application Security -
     Science or Quality Assurance?




Nazar Tymoshyk Ph.D, Security Consultant, R&D at SoftServe
Famous Security Professionals



   Richard Stallman       Linus Torvalds   Tsutomu Shimomura




          Robert Morris             Stephen Wozniak
Famous “Security Professionals”




  Adrian Lamo       Kevin Mitnick        Kevin Poulsen




         Gary McKinnon         Jonathan James
What about famous QA professionals?
So you know where to move ;)


                     Security is also metric
                       of Software Quality

         “The simple truth is that catching
           security holes earlier costs an
       organization less to remediate, which
           makes good business sense. ”
QA Engineer                                   Security Analyst




           In functional and performance
        testing, the expected results are    In security testing, the quality
documented before the test begins, and       assurance team is concerned only
the quality assurance team looks at how      with unexpected results and testing
     well the expected results match the     for the unknown.
                            actual results
Weapon




Passion           Tools
Persistence     Guides
Research      Checklists
Collaboration and Team work

   “ IT security and quality   IT security
         assurance working     department, which will
together are exponentially     help remove more risk
 more powerful. The result     and provide better
   will be a more security-    continuity ”
  oriented QA department
        and a more quality-
                   oriented
OWASP




  SAMM   WAF   Development
                             Testing guide   ASVS
                  guide
Microsoft approach
Testing security with Tools


Core Impact                        Burp
Accunetix WVS                      w3af
HP WebInspect                 OWASP ZAP
IBM Rational            OWASP Mantra
AppScan
DEMO
Let’s test small web-site with
commercial and free tools
Applying       Get tools from:
             http://goo.gl/eHl2u

Science
approach



                  Targets:
           http://192.168.195.34
           http://192.168.195.80
Smashing the app



   Remote code execution – one of the most dangerous vulnerabilities in
   web-apps


   How to achieve a goal:
   •   Upload scripts to server
   •   Remote File Inclusion (RFI)
   •   Local File Inclusion (LFI)
Unrestricted file upload

 File upload – vulnerability allow remote attacker to upload
 files/scripts on server with special content or random extension.
 This vulnerability exist through incorrect file extension implementation.

 Incorrect methods of uploaded file extension validation :
 • Validation of MIME-type of uploading file vs validation of
     file extention
 •    Black-list extension validation
 •    Other errors…
 Unsecure web-server/application server configuration play also important
 role.
Upload your shell
Changing MIME type
 Validation sample:

 <?php
 $imageTypes = array("image/gif", "image/jpg", "image/png");

 if(isset($_FILES["image"])) {
            if(!in_array($_FILES["image"]["type"],              $imageTypes)) {
                       die("Hacking Attempt!");    }
            copy($_FILES["image"]["tmp_name"], "images/{$_FILES["image"]["name"]}");
 } ?>

 Problem: It’s easy to change type of file – as it’s setting by
 browser in HTTP-request. And all variables that are set by
 browser – can be easily changed by user.
Content                  Black list:
validation               Wrong way
             <?php if(isset($_FILES["image"])) {
             if(preg_match('#.((php)|(php3)|(
             php4)|(php5))$#i',$_FILES["image
             "]["name"])
             ){
             die("Hacking Attempt!");
             }
             copy($_FILES["image"]["tmp_nam
             e"], "images/{$_FILES["image"]["n
             ame"]}"); } ?>
Regular expressions
 <?php
 if(isset($_FILES["image"])) {
 if(preg_match('#.jpg#i',         $_FILES["image"]["name"])) {
          copy($_FILES["image"]["tmp_name"], "images/{$_FILES["image"]["name"]}
 ");
 } } ?>


 In this sample name of uploaded file is checking for
 string .jpg. But regular expression is working as control
 symbol $ that indicate EOL is missed,.

 As a result file shell.jpg.php will be successes fully
 uploaded.
Right way

 <?php
 if(isset($_FILES["image"])) {
 if(preg_match('#^[a-z0-9-
 _]+.((jpg)|(png)|(bmp))$#i', $_FILES["image"]["name"])
         ){
         move_uploaded_file($_FILES["image"]["tmp_name"], "ima
 ges/{$_FILES["image"]["name"]}");
 }     }
 ?>                                        White list
                                           validation
Local File
Inclusion

 Local File Inclusion – allow to include local files on remote server
 and execute arbitrary code.

 Reason: incorrect linked file validation, vulnerable server
 configuration

 Successfully LFI exploitation have three main task :
 • Removing of postfix
 •   Directory Traversal
 •   Searching files for code injection
Directory
Traversal
 Filtration can prevent Directory Traversal.
 Very often developers apply Filtration of ../ :
    <?php include(str_replace("../", "", $_GET["page"]).".inc"); ?>
    ../../../etc/passwd --> Filtration --> etc/passwd --> fail 
    But such filtration is not enough – it’s not recursive:
    ..././..././..././etc/passwd --> Filtration --> ../../../etc/passwd --> profit 
Secure Validation

 Secure Validation – validation of filename for service
 symbols
 if(preg_match('#[^a-z0-9-_]#i', $page)) {
       die("Hacking Attempt!");
 }
 include("{$page}.inc");


 In this sample if we will try to add file with symbols
 other than A-Z, a-z, 0-9 and symbol «-» & «_» execution
 of PHP-script will be interrupted.
So, how to become Security Analyst


Use OWASP                      Researches
Ask and share              Participate in
                            community
Samurai WTF

            talk on Security
                 Hole 
Feedbacks & Questions

 Contact Nazar:
 skype: root_nt
 email: root.nt@gmail.com



 Presentation & Files:
 http://goo.gl/eHl2u
                            ?
Leave your Feedbacks:           Join OWASP Lviv:
http://goo.gl/FW4ar             https://www.owasp.org
                                /index.php/Lviv

Mais conteúdo relacionado

Mais procurados

Web application penetration testing
Web application penetration testingWeb application penetration testing
Web application penetration testingImaginea
 
Web Application Penetration Testing Introduction
Web Application Penetration Testing IntroductionWeb Application Penetration Testing Introduction
Web Application Penetration Testing Introductiongbud7
 
Oh, WASP! Security Essentials for Web Apps
Oh, WASP! Security Essentials for Web AppsOh, WASP! Security Essentials for Web Apps
Oh, WASP! Security Essentials for Web AppsTechWell
 
Penetration Testing Basics
Penetration Testing BasicsPenetration Testing Basics
Penetration Testing BasicsRick Wanner
 
Introduction to Security Testing
Introduction to Security TestingIntroduction to Security Testing
Introduction to Security TestingvodQA
 
Axoss Web Application Penetration Testing Services
Axoss Web Application Penetration Testing ServicesAxoss Web Application Penetration Testing Services
Axoss Web Application Penetration Testing ServicesBulent Buyukkahraman
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Codingbilcorry
 
Finacle - Secure Coding Practices
Finacle - Secure Coding PracticesFinacle - Secure Coding Practices
Finacle - Secure Coding PracticesInfosys Finacle
 
OWASP Secure Coding Practices - Quick Reference Guide
OWASP Secure Coding Practices - Quick Reference GuideOWASP Secure Coding Practices - Quick Reference Guide
OWASP Secure Coding Practices - Quick Reference GuideLudovic Petit
 
Web application security
Web application securityWeb application security
Web application securityKapil Sharma
 
Owasp top 10 security threats
Owasp top 10 security threatsOwasp top 10 security threats
Owasp top 10 security threatsVishal Kumar
 
Beyond the OWASP Top 10
Beyond the OWASP Top 10Beyond the OWASP Top 10
Beyond the OWASP Top 10iphonepentest
 
Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017TriNimbus
 

Mais procurados (19)

Web application penetration testing
Web application penetration testingWeb application penetration testing
Web application penetration testing
 
Web Application Penetration Testing Introduction
Web Application Penetration Testing IntroductionWeb Application Penetration Testing Introduction
Web Application Penetration Testing Introduction
 
Oh, WASP! Security Essentials for Web Apps
Oh, WASP! Security Essentials for Web AppsOh, WASP! Security Essentials for Web Apps
Oh, WASP! Security Essentials for Web Apps
 
Security testing
Security testingSecurity testing
Security testing
 
Penetration Testing Basics
Penetration Testing BasicsPenetration Testing Basics
Penetration Testing Basics
 
Security testing
Security testingSecurity testing
Security testing
 
Introduction to Security Testing
Introduction to Security TestingIntroduction to Security Testing
Introduction to Security Testing
 
OWASP Top 10 Project
OWASP Top 10 ProjectOWASP Top 10 Project
OWASP Top 10 Project
 
Axoss Web Application Penetration Testing Services
Axoss Web Application Penetration Testing ServicesAxoss Web Application Penetration Testing Services
Axoss Web Application Penetration Testing Services
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Coding
 
Finacle - Secure Coding Practices
Finacle - Secure Coding PracticesFinacle - Secure Coding Practices
Finacle - Secure Coding Practices
 
OWASP Secure Coding Practices - Quick Reference Guide
OWASP Secure Coding Practices - Quick Reference GuideOWASP Secure Coding Practices - Quick Reference Guide
OWASP Secure Coding Practices - Quick Reference Guide
 
Security-testing presentation
Security-testing presentationSecurity-testing presentation
Security-testing presentation
 
Owasp
Owasp Owasp
Owasp
 
Web application security
Web application securityWeb application security
Web application security
 
Owasp top 10 security threats
Owasp top 10 security threatsOwasp top 10 security threats
Owasp top 10 security threats
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelines
 
Beyond the OWASP Top 10
Beyond the OWASP Top 10Beyond the OWASP Top 10
Beyond the OWASP Top 10
 
Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017
 

Destaque

Sh#3 incident forensics
Sh#3 incident forensicsSh#3 incident forensics
Sh#3 incident forensicsTjylen Veselyj
 
How to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityHow to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityYurii Bilyk
 
Security Hole #11 - Unusual security vulnerabilities - Yuriy Bilyk
Security Hole #11 - Unusual security vulnerabilities - Yuriy BilykSecurity Hole #11 - Unusual security vulnerabilities - Yuriy Bilyk
Security Hole #11 - Unusual security vulnerabilities - Yuriy BilykNazar Tymoshyk, CEH, Ph.D.
 
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"Nazar Tymoshyk, CEH, Ph.D.
 
Building better product security
Building better product securityBuilding better product security
Building better product securityBohdan Serednytskyi
 
Virtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the CloudVirtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the CloudTjylen Veselyj
 
Welcome to the world of hacking
Welcome to the world of hackingWelcome to the world of hacking
Welcome to the world of hackingTjylen Veselyj
 
Security Hole #11 - Competitive intelligence - Beliaiev
Security Hole #11 - Competitive intelligence - BeliaievSecurity Hole #11 - Competitive intelligence - Beliaiev
Security Hole #11 - Competitive intelligence - BeliaievNazar Tymoshyk, CEH, Ph.D.
 
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the HoodYurii Bilyk
 
Intro to Security in SDLC
Intro to Security in SDLCIntro to Security in SDLC
Intro to Security in SDLCTjylen Veselyj
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?Yurii Bilyk
 

Destaque (12)

Sh#3 incident forensics
Sh#3 incident forensicsSh#3 incident forensics
Sh#3 incident forensics
 
How to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityHow to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole City
 
Security Hole #11 - Unusual security vulnerabilities - Yuriy Bilyk
Security Hole #11 - Unusual security vulnerabilities - Yuriy BilykSecurity Hole #11 - Unusual security vulnerabilities - Yuriy Bilyk
Security Hole #11 - Unusual security vulnerabilities - Yuriy Bilyk
 
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
 
Building better product security
Building better product securityBuilding better product security
Building better product security
 
Virtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the CloudVirtual Machine Introspection - Future of the Cloud
Virtual Machine Introspection - Future of the Cloud
 
Welcome to the world of hacking
Welcome to the world of hackingWelcome to the world of hacking
Welcome to the world of hacking
 
Security Hole #11 - Competitive intelligence - Beliaiev
Security Hole #11 - Competitive intelligence - BeliaievSecurity Hole #11 - Competitive intelligence - Beliaiev
Security Hole #11 - Competitive intelligence - Beliaiev
 
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
 
Intro to Security in SDLC
Intro to Security in SDLCIntro to Security in SDLC
Intro to Security in SDLC
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
 
Agile and Secure SDLC
Agile and Secure SDLCAgile and Secure SDLC
Agile and Secure SDLC
 

Semelhante a Security hole #5 application security science or quality assurance

香港六合彩
香港六合彩香港六合彩
香港六合彩baoyin
 
Penetration testing dont just leave it to chance
Penetration testing dont just leave it to chancePenetration testing dont just leave it to chance
Penetration testing dont just leave it to chanceDr. Anish Cheriyan (PhD)
 
Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view
Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s viewNguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view
Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s viewSecurity Bootcamp
 
BSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated TestingBSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated TestingAndrew McNicol
 
Break it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareBreak it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareLeigh Honeywell
 
Slides
SlidesSlides
Slidesvti
 
Shift Left Security
Shift Left SecurityShift Left Security
Shift Left Securitygjdevos
 
Agnitio: its static analysis, but not as we know it
Agnitio: its static analysis, but not as we know itAgnitio: its static analysis, but not as we know it
Agnitio: its static analysis, but not as we know itSecurity BSides London
 
Security guidelines
Security guidelinesSecurity guidelines
Security guidelineskarthz
 
Building Security Controls around Attack Models
Building Security Controls around Attack ModelsBuilding Security Controls around Attack Models
Building Security Controls around Attack ModelsSeniorStoryteller
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxFernandoVizer
 
You need a PROcess to catch running processes and their modules_v2.0
You need a PROcess to catch running processes and their modules_v2.0You need a PROcess to catch running processes and their modules_v2.0
You need a PROcess to catch running processes and their modules_v2.0Michael Gough
 
[CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst
[CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst [CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst
[CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst PROIDEA
 
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)Steve Poole
 
Finding Security a Home in a DevOps World
Finding Security a Home in a DevOps WorldFinding Security a Home in a DevOps World
Finding Security a Home in a DevOps WorldShannon Lietz
 
Geecon 2017 Anatomy of Java Vulnerabilities
Geecon 2017 Anatomy of Java VulnerabilitiesGeecon 2017 Anatomy of Java Vulnerabilities
Geecon 2017 Anatomy of Java VulnerabilitiesSteve Poole
 

Semelhante a Security hole #5 application security science or quality assurance (20)

香港六合彩
香港六合彩香港六合彩
香港六合彩
 
Cyber ppt
Cyber pptCyber ppt
Cyber ppt
 
Penetration testing dont just leave it to chance
Penetration testing dont just leave it to chancePenetration testing dont just leave it to chance
Penetration testing dont just leave it to chance
 
Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view
Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s viewNguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view
Nguyen Huu Trung - Building a web vulnerability scanner - From a hacker’s view
 
BSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated TestingBSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated Testing
 
Break it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareBreak it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure software
 
Slides
SlidesSlides
Slides
 
Shift Left Security
Shift Left SecurityShift Left Security
Shift Left Security
 
OWASP an Introduction
OWASP an Introduction OWASP an Introduction
OWASP an Introduction
 
Agnitio: its static analysis, but not as we know it
Agnitio: its static analysis, but not as we know itAgnitio: its static analysis, but not as we know it
Agnitio: its static analysis, but not as we know it
 
Dev{sec}ops
Dev{sec}opsDev{sec}ops
Dev{sec}ops
 
Security guidelines
Security guidelinesSecurity guidelines
Security guidelines
 
Building Security Controls around Attack Models
Building Security Controls around Attack ModelsBuilding Security Controls around Attack Models
Building Security Controls around Attack Models
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
You need a PROcess to catch running processes and their modules_v2.0
You need a PROcess to catch running processes and their modules_v2.0You need a PROcess to catch running processes and their modules_v2.0
You need a PROcess to catch running processes and their modules_v2.0
 
ISC2: AppSec & OWASP Primer
ISC2: AppSec & OWASP PrimerISC2: AppSec & OWASP Primer
ISC2: AppSec & OWASP Primer
 
[CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst
[CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst [CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst
[CONFidence 2016] Jacek Grymuza - From a life of SOC Analyst
 
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
 
Finding Security a Home in a DevOps World
Finding Security a Home in a DevOps WorldFinding Security a Home in a DevOps World
Finding Security a Home in a DevOps World
 
Geecon 2017 Anatomy of Java Vulnerabilities
Geecon 2017 Anatomy of Java VulnerabilitiesGeecon 2017 Anatomy of Java Vulnerabilities
Geecon 2017 Anatomy of Java Vulnerabilities
 

Security hole #5 application security science or quality assurance

  • 1.
  • 2. Application Security - Science or Quality Assurance? Nazar Tymoshyk Ph.D, Security Consultant, R&D at SoftServe
  • 3. Famous Security Professionals Richard Stallman Linus Torvalds Tsutomu Shimomura Robert Morris Stephen Wozniak
  • 4. Famous “Security Professionals” Adrian Lamo Kevin Mitnick Kevin Poulsen Gary McKinnon Jonathan James
  • 5. What about famous QA professionals?
  • 6. So you know where to move ;) Security is also metric of Software Quality “The simple truth is that catching security holes earlier costs an organization less to remediate, which makes good business sense. ”
  • 7. QA Engineer Security Analyst In functional and performance testing, the expected results are In security testing, the quality documented before the test begins, and assurance team is concerned only the quality assurance team looks at how with unexpected results and testing well the expected results match the for the unknown. actual results
  • 8. Weapon Passion Tools Persistence Guides Research Checklists
  • 9. Collaboration and Team work “ IT security and quality IT security assurance working department, which will together are exponentially help remove more risk more powerful. The result and provide better will be a more security- continuity ” oriented QA department and a more quality- oriented
  • 10. OWASP SAMM WAF Development Testing guide ASVS guide
  • 12. Testing security with Tools Core Impact Burp Accunetix WVS w3af HP WebInspect OWASP ZAP IBM Rational OWASP Mantra AppScan
  • 13. DEMO Let’s test small web-site with commercial and free tools
  • 14. Applying Get tools from: http://goo.gl/eHl2u Science approach Targets: http://192.168.195.34 http://192.168.195.80
  • 15. Smashing the app Remote code execution – one of the most dangerous vulnerabilities in web-apps How to achieve a goal: • Upload scripts to server • Remote File Inclusion (RFI) • Local File Inclusion (LFI)
  • 16. Unrestricted file upload File upload – vulnerability allow remote attacker to upload files/scripts on server with special content or random extension. This vulnerability exist through incorrect file extension implementation. Incorrect methods of uploaded file extension validation : • Validation of MIME-type of uploading file vs validation of file extention • Black-list extension validation • Other errors… Unsecure web-server/application server configuration play also important role.
  • 18. Changing MIME type Validation sample: <?php $imageTypes = array("image/gif", "image/jpg", "image/png"); if(isset($_FILES["image"])) { if(!in_array($_FILES["image"]["type"], $imageTypes)) { die("Hacking Attempt!"); } copy($_FILES["image"]["tmp_name"], "images/{$_FILES["image"]["name"]}"); } ?> Problem: It’s easy to change type of file – as it’s setting by browser in HTTP-request. And all variables that are set by browser – can be easily changed by user.
  • 19. Content Black list: validation Wrong way <?php if(isset($_FILES["image"])) { if(preg_match('#.((php)|(php3)|( php4)|(php5))$#i',$_FILES["image "]["name"]) ){ die("Hacking Attempt!"); } copy($_FILES["image"]["tmp_nam e"], "images/{$_FILES["image"]["n ame"]}"); } ?>
  • 20. Regular expressions <?php if(isset($_FILES["image"])) { if(preg_match('#.jpg#i', $_FILES["image"]["name"])) { copy($_FILES["image"]["tmp_name"], "images/{$_FILES["image"]["name"]} "); } } ?> In this sample name of uploaded file is checking for string .jpg. But regular expression is working as control symbol $ that indicate EOL is missed,. As a result file shell.jpg.php will be successes fully uploaded.
  • 21. Right way <?php if(isset($_FILES["image"])) { if(preg_match('#^[a-z0-9- _]+.((jpg)|(png)|(bmp))$#i', $_FILES["image"]["name"]) ){ move_uploaded_file($_FILES["image"]["tmp_name"], "ima ges/{$_FILES["image"]["name"]}"); } } ?> White list validation
  • 22. Local File Inclusion Local File Inclusion – allow to include local files on remote server and execute arbitrary code. Reason: incorrect linked file validation, vulnerable server configuration Successfully LFI exploitation have three main task : • Removing of postfix • Directory Traversal • Searching files for code injection
  • 23. Directory Traversal Filtration can prevent Directory Traversal. Very often developers apply Filtration of ../ : <?php include(str_replace("../", "", $_GET["page"]).".inc"); ?> ../../../etc/passwd --> Filtration --> etc/passwd --> fail  But such filtration is not enough – it’s not recursive: ..././..././..././etc/passwd --> Filtration --> ../../../etc/passwd --> profit 
  • 24. Secure Validation Secure Validation – validation of filename for service symbols if(preg_match('#[^a-z0-9-_]#i', $page)) { die("Hacking Attempt!"); } include("{$page}.inc"); In this sample if we will try to add file with symbols other than A-Z, a-z, 0-9 and symbol «-» & «_» execution of PHP-script will be interrupted.
  • 25. So, how to become Security Analyst Use OWASP Researches Ask and share Participate in community Samurai WTF talk on Security Hole 
  • 26. Feedbacks & Questions Contact Nazar: skype: root_nt email: root.nt@gmail.com Presentation & Files: http://goo.gl/eHl2u ? Leave your Feedbacks: Join OWASP Lviv: http://goo.gl/FW4ar https://www.owasp.org /index.php/Lviv

Notas do Editor

  1. Еще его называют «Воз» или «Стив из Apple» (ведь Возняк на пару с Джобсом основали AppleComputer). Воз начал заниматься хакерством с создания блю-боксов, которые позволяют пользователям обходить механизмы переключения в телефонных линиях, для того чтобы совершать междугородные звонки бесплатно. Джобс и Воз продавали эти блю-боксы сокурсникам и даже использовали один из них сами для звонка Папе Римскому, притворяясь Генри Киссинджером (госсекретарем США).ТсутомуШимомура осознанно открыл свой компьютер для второй атаки, чтобы выследить Митника. Вскоре после обнаружения взлома он собрал команду и продолжил работу по поимке
  2. Адриан Ламо — известен взломом Yahoo, Citigroup, BankofAmerica иCingular.Джонатан Джеймс — американский хакер, стал первым несовершеннолетним, осужденным за хакерство.Кевин Поулсен — взломал базу данных ФБР и получил доступ к засекреченной информации, касающейся прослушивания телефонных разговоров. Поулсен долго скрывался, изменяя адреса и даже внешность, но в конце концов он был пойман и осужден на 5 лет. После выхода из тюрьмы работал журналистом, затем стал главным редактором WiredNews. Его самая популярная статья описывает процесс идентификации 744 сексуальных маньяков по их профилям в MySpace.Гэри Маккиннон — обвиняется во взломе 53-х компьютеров Пентагона и НАСА в 2001—2002 годах в поисках информации об НЛО.Джеймс стал самым молодым хакером в истории. Еще в 16 лет его отправили в тюрьму за компьютерные атаки на подразделения Министерства обороны США. Благодаря этому взлому он получил доступ к именам пользователей и паролям, а также смог просматривать письма высокой секретности. Среди его «побед» нужно отметить проникновение в сеть NASA (он умудрился украсть ПО на сумму больше чем в $1,5 млн). После обнаружения взлома NASA пришлось отключить систему для проверки, что обошлось налогоплательщикам в $41 000. Сейчас Джеймс, как многие другие его коллеги-«черношапочники», стал законопослушным гражданином и планирует открыть компанию по обеспечению компьютерной безопасности. 
  3. Завжди знайдеться розширення файлу яке не входить в список