+ All Categories
Home > Documents > Web App Pen Testing tools of the trade -...

Web App Pen Testing tools of the trade -...

Date post: 09-Apr-2018
Category:
Upload: ngodat
View: 216 times
Download: 1 times
Share this document with a friend
104
WEB APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING
Transcript
Page 1: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

WEBAPPPENTESTINGTOOLSOFTHETRADE

ISSAALLDAYTRAINING

Page 2: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SERGEBORSONOVEMBER2016

Page 3: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

ABOUTME

• JurassicPark(1993)• Biometrics• BankingApplicationSecurity• ApplicationDevelopment• PenetrationTesting• SANSCommunityInstructor• Owner:SpyderSec(InformationSecurityConsulting)

Page 4: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

ABOUTTHISTRAINING

• Whatyousignedupfor…• WebAppPenTestingToolsofTheTrade• Methodology,vulnerabilities,manualandautomatedexploitation• Talkabouttopic– thenexploretopicinteractively(LecturethenLab)• Hands-on• Focusontools• Learn&HAVEFUN!

Page 5: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

HANDS-ONLABS

• Thereare5ofthem:• Browsers• Proxies• Nmap/bash• sqlmap• BeEF• Mygoal/intentisforyoutoleavewithknowledgeofthetopicscoveredandanunderstandingoftheirrelevancyforyouinyourcurrent/futurerole

Page 6: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PROGRESSIONOFTODAY8:00- 4:30

• Breakfast- Intro• Lecture– Lab#1• Lecture– Lab#2• Lecture– Lunch– Lab#3• Lecture– Lab#4• Lecture– Lab#5

Page 7: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

CRITICALINFORMATION

• LocationofrestroomsJ• Networkconnectivityandyourlaptop(youhaveKaliright?)• Makesureyoucanaccesstheinternet• Incaseofemergency• Permissiontoengageinattackscenarios• Questions/AnythingImissed?

Page 8: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

TELLMEABOUTYOU

• Name• Occupation• Experience

• Whatyouwanttogetoutofthisclass(anddon’tsayCPEsJ )

Page 9: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

WEBAPPLICATIONS

• Whatarethey?• Appvswebsite• Howdotheywork?• CommonExamples…

Page 10: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PENETRATIONTESTING

• Whatisit?• Whattypesarethere?• Whatiswebapppentestingspecifically?• RedTeam,BlueTeam,whitebox,blackbox,greybox…• Whatitthegoal?• Scanningvspenetrationtesting

Page 11: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

TOOLS

• Whatwouldatoolbeinthiscontext?• Software!• Scripts• Specifictotheweborapplicationsornetworkconnectivity

Page 12: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LETSBEGINWITHBROWSERS

• Abrowseristhe#1toolforaWebApplicationPenetrationTester;seriously• Butwhy?Andwhywouldwecareaboutthebrowser?• Wecarealotactually• Renderpages• Accessingsites(compatibilitymodesorRIA)• Makeourliveseasier(automation)• Visibilitybehindthescenes• Interactingwithapplications(HTML5support)

Page 13: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BROWSERCHOICES• Firefox• Chrome• Opera• Safari• Mobilebrowsers• Links(textbasedbrowser)• Andifyouhavenothingelse…IE• Donottakestatsatfacevalue(w3schools.com)

Page 14: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

FIREFOX

• Yes,FireFox• FireFox isKingbecauseofit’sversatility(thisisallsubjective)• Versatilityasin:Add-ons!• Proxysupportisunmatched(lesssubjective)Note– grouppolicyatoffice*• ThisisNOTthemostsecure,orfastestoradvanced

• Usethebesttoolforthegivenjob– ThiswillbearecurringthemeJ

Page 15: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

CHROME

• Anothergreatchoice(dependingonthesituation)• Stable,fast,modern(CSS3,HTML5– goodsupportforboth)• Webdevelopmenttoolsarequitegood• Moresecurethansome(sandboxing)• Notthemost“advanced”

Page 16: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT
Page 17: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

ANDTHEREST…

• WejokeaboutIEbutEdgeisactuallynotbad• Howwillpagesrender?• Whatadd-onsaresupported?WhatOSdowehave?• SecurityandfeaturescomeintoplaywithXSSattacks

Page 18: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

TRIVIA

• Q:Whichbrowsernowoffersfreebuilt-inVPNsupport?• Meaningyouopenyourbrowser,clickabuttonandconnecttoaVPN

• A:Operaasofabout2monthsabout…anditworkswell!

Page 19: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

KEEPINGINMIND

• Theapplication/engagementmightdictatethebrowserweuse• Doweneedcustomproxysupport?That’sFireFox• ActiveX?That’sgoingtobeIEforsure• AdvancedHTML5andjs supportrequired?Chromeisagoodchoice• Arewerestrictedtoaterminalforsomeoddreason?Linkstotherescue• Goesbacktothebesttoolforthejob• Whichbrowserareyoumostcomfortablewith?• It’sprobablygoingtobeIceWeasel todayJ

Page 20: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

THEGOALOFGETTINGTOKNOWYOURBROWSER

• Learnitssecrets• Strengths,weaknesses• Allaboutwieldingatoollikeaprofessional• Youwouldn’tusegoogletosearchthecontentsofasitewithout“site:”right?

• Whatdoesthatmean?• Ifyouaregoingtodosomething,doitwell

Page 21: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LAB#1BROWSERS

• #1SpinupKali• #2OpenBrowser(IceWeasel)• #3Browsetodenvertrainingday.com:11432/BrowserLab1.php• #4Followinstructionsonpage• Alreadycompleted/seekingsomethingmoreadvanced?Goto/BLA.php

Page 22: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BROWSERRECAP

• CircumventingHSTS*• Viewingheaders• Modifyandexportcookies• Easyproxychanges• Tamperwithrequests• AssessApplications– easytofindvulnerabilitiesQuestionsonthisLab?

Page 23: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

INTERCEPTIONPROXIES

• Twothatwewilltalkabout:• OWASP’sZAP• Burp(Freeversion)• Severalothersavailable

Page 24: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

WHATISANINTERCEPTIONPROXY• Anothertool– thisoneallowsustoviewandmodifyrawHTTPrequests• Softwarethatsitslogicallybetweenthebrowserandwebapplication• Browsersendsallrequeststotheproxy• Proxyforwardstheserequeststotheintendedwebapplication• Webapplicationresponds,responsegoesbackthroughproxy• Proxysendsresponsebacktobrowserandthepageloadsinbrowser• Lookslikethis…

Page 25: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PROXYVIEW

Page 26: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PROXYVIEW

Page 27: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

INTERCEPTIONPROXYSPECIFICS• Potenttoolforourarsenal• Youcangetbywithabrowserandaproxyformajorityofthetesting(dependingonscope)

• Theproxyiswhereautomationcomesintoplay• Andattacks:• Malicioustraffic• Fuzzing• Identifyingvulnerabilities

Page 28: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

VULNERABILITIESWECANEXPECTTOFIND

• Usingaproxyasapassiveoractivescanner• Essentiallywatchesyourrequestsaswellasserverresponses• Determinesifthereareissuessuchas:• XSS• SQLi• XSRF(CSRF)• Harvesting• Insecureconfigurations&more

Page 29: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SPEAKINGOFVULNERABILITIES

• Weakness• Attacksurface• SecurityBug• WithanOSorsoftwarewetypicallyhaveapatchforremediation• Awebappvulnerabilityfixmightentailacodechangeanddeployment• Afteritmakesittothebacklogandafterthoroughtestingandapprovals• Manyvulnerabilitieswillnotbefixed*really*

Page 30: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

VULNERABILITIESREMAIN

• Andtheylingerforyearssometimes• Usuallyduetolowriskorlowprobabilityofexploitation• InMANYcasesbecausesecuritypeopledon’texplaintheriskwellenough• Othertimesit’s3rd partycodeandwedon’thavedirectcontrol/influence• Alotoftheriskcomesdownontheclientoruseroftheapplication• Riskisthecriticalelementthough,evenSQLi mightnotgetfixed*

Page 31: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

HOWDOWEFINDTHESEVULNERABILITIES?

• Wellwehaveamethodology:• Recon• Mapping• Scanning• Exploitation• Toolslikeaproxyhelpinsomephasesmorethanothers

Page 32: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

RECON• OSINT• Googlesearches• Sourcecode(HTML)orrepository• Whois• DNS• Etc• Proxieshelpwithautomatingsomeofthisbutnotmuch

Page 33: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

MAPPING

• Thisisthedomainoftheproxysotospeak• Mappingiswhereaproxyexcels• Basicallythisisspidering theside• Morespecificallywearelookingforallpages,allfeatures/functions,businesslogic,andtherelationshipsbetweenapplicationcomponents

• Aproxywillautomatethisandmakeusawareofeverythingitcanfind

Page 34: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SCANNINGANDFUZZING

• NotsprayingtheheapandlookingforRCE• Mentionedpassivevsactivescanning• Oncewehaveasolidmapoftheapplicationwecanstartactivelyscanning• Thisiswhereweleverageawebappvulnerabilityscanner• ZAPhasonebuilt-inaspartofthetool• WithBurpwehavetopayforproversiontogetscanningfeatures$350

Page 35: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LASTSTEP(S):EXPLOITATIONANDSTARTOVER

• Exploitationismoreoramanualprocessinasense• Oncewefindanissueweexploitit• Findnewattacksurfaceandstartthecycleoveragain• Supposewesuccessfulgainadminrightstoanapplication• Nowwemapnewfeaturesoftheappwedidn’tknowaboutbefore• It’saniterative/cyclicalmethodology…

Page 36: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BACKTOTHEPROXY

Page 37: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

ZAPVIEW

Page 38: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LEVERAGINGAPROXY

• Starttheproxy• Configureit(defaultsworkfineforawhile)• Configureyourbrowsertouseit• Learnaboutthefeatures• Seehowitcanbeusedtomakeyourlifeeasier• Seehowitcanbeusedtomakeyourtestingmoreefficient• Let’sdoademothenalab

Page 39: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PROXYDEMO:SCANNINGANDFUZZING

• Goalistoshowhowtouseabrowser&proxytoscanandfuzzatarget

Page 40: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LAB#2PROXY• #1LogintoKali• #2OpenBrowser(IceWeasel)• #3Browsetodenvertrainingday.com:11432/ProxyLab1.php• #4Followinstructionsonpage• Alreadycompleted/seekingsomethingmoreadvanced?Goto/PLA.php• Takeabreak

Page 41: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PROXYRECAP

• Whatdidwelearn?• That“intercept”buttonisannoying• Youwillbepromptedtosubmitpopulatedforms• Thisisnotavulnerabilityscanner,takeslotsofmanual“driving”• Greatatautomatingsometasks• Yougetwhatyoupayfor(throttling)

Page 42: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LET’STALKNMAP ANDBASH

• Webapplicationpenetrationtestingisnot100%webappfocused…ever• Wehavetolookforplatformvulnerabilities• BepreparedtoidentifyandexploitSSLissues(heartbleed)• AswellasinjectionvulnerabilitieswhichcanleadtoOSaccess• Onceashellisgainedandevenduringpursuitweshiftawayfromtheapp• Thereforewewieldmultifunctionaltools,likeaSwissarmyknifeperhaps

Page 43: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

NMAP

• Thefirstoneofthesetoolsisnmap• Thehighestqualitynetworkmappingtool• Usuallyusedtofindopenports• Identifyrunningservices• OSchecks• Traceroute• Troubleshootnetworkingissues• AndhelpTrinity

Page 44: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

NOTJUSTAPORTSCANNERHOWEVER

• Justusingnmap forportscanning…comeoutofthestoneage• NSE– thenmap scriptingengine• Extensibility• Lua basedprogramminglanguageallowsustocreateourownscripts• ls/usr/share/nmap/scripts|wc -l• Severalhundredsuchscriptsarecurrentlyavailablebydefault

Page 45: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

NSE

• Methodologyonceagain:Recon,mapping,scanning,exploitation• Reconscripts• Mapping/spidering script(s)• Scanningoptions• Exploitationaswell

Page 46: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SOMENMAP EXAMPLES

Page 47: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SOMENSE EXAMPLES

Page 48: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

NSE HTTPSCRIPTS

• Quiterelevanttopenetrationtestingawebapp…• HTTPheader,HTTPgrep,HTTPbruteforce,referrercheck• Spider,robots.txt,slowloris check,sql injection• XSS,title,methods,formfuzzer,shellshock,trace• Vhosts,anddozen+knownvulnerabilitychecks• 100+NSEHTTPscriptsatourdisposal

Page 49: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

ANOTHERMULTIFUNCTIONTOOL:BASH

• Extremelycapableshell• Allowsustoautomateattacks• Createinput/fuzzinglists• Leverageothercommandlinetools• Interactwithbuilt-incommandstoparsefiles• Chainattacksandtools• AttackAPIswithease

Page 50: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

USINGNSESCRIPTS

• Invokethescriptofyourchoicewith“script=“oncommandline• Canaddmultiplescriptstogether• nmap –p80--script=script.nse,script2.nse,http-vhosts.nse• Somescriptsrequirearguments• OnethingIdon’tlike…lackofresults/indicatorforfailedscript• Mayneedtodebug(-d)totroubleshootsomeissues

Page 51: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

WHYBASHANDNMAP

• It’snotalwaysjustoneapplicationforourtestingscope• Theapplicationsarenotonlyrunningon80and443• Redundanttasksrequireautomationforefficiency• i.e.IfIneedtopulldownrobots.txtoneverytarget;timetoscriptthat• IfIneedtomanglewordlists– forxin`catfile`;doecho$x|sed…• IfIneedtocreatexdigitnumbersforfuzzing• IfIneedtosleepwhilegettingworkdoneandbeingproductive:True!

Page 52: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BASHANDNMAP• Thegoalhereistoaddtoolstothearsenal• Learntousethemeffectively• Anyonecanrunatool• WhatIwanttoimpartonyouislearnwhatthetoolsdoes• Howthetooloperates• Howitworksunderthehood• Replicateitsfunctionalityusingmanualmethods

Page 53: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

MANUALEFFORTS

• Wehavearangeofhoststotest• Wewanttoknowwhattypeofserver(s)wearetargeting• Weneedtoknowtheplatformtocrafttailoredattacks• i.e.whatistheOS,languageanddatabase?• Ifit’saMSSQLdatabase,SQLi attackswithOraclesyntaxisawasteoftime• Wecanbrowseanduseanadd-onordevelopertoolstoseeheaders• Wecanusewget,orncat ornmap or…

Page 54: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

USINGABROWSER

Page 55: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BASHBASICS

• Grep• Awk• Sed• Cut• |• forloop• ls,cat,wget (curl)

Page 56: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

COMMANDBASICS

• Lookatafile(outputit’scontentstothescreen):cat• catfile.txt• Searchforastring:grep• grepstringIwantToSearchFor file.txt• Downloadafile/pagefromawebsite• wget www.example.com

Page 57: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

PUTTINGITTOGETHER

• SavepageandHTTPheaders• wget –save-headersexample.com• Parsesavedfileandpulloutserverheader• grep‘Server:’index.html• Grabjusttheservernameandsaveittoafile• grep‘Server:’index.html|cut–d‘‘–f2,3>>SavedHeaders.txt

Page 58: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

AUTOMATEIT

• catTargets…example.comDenver.issa.orgnmap.org• forxin`catTargets`;dowget –save-headers$x;done• grep‘Server:’index.html*|cut–d‘‘–f2,3>>SavedHeaders.txt• CatSavedHeaders.txt…ECS(den/1D77)ApacheApache/2.4.6(CentOS)

Page 59: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LAB#3NMAP ANDBASH• #1LogintoKali• #2OpenBrowser(IceWeasel)• #3Browsetodenvertrainingday.com:11432/NBLab1.php• #4Followinstructionsonpage• Seekingsomethingmoreadvanced?Goto/NHL.php• Eatlunch

Page 60: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BASHANDNMAP RECAP

• Whatdidwelearn?• Viewingoutputisprudent• Needtoknowwhattoparse

• nmap makesiteasierJ• Butnowweknowhowtodoitourselves• nmap anditsscriptsareopensource…wanttoknowwhattheydo?Look!• Anyquestionswiththislab?

Page 61: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLINJECTION

• Sameasbefore...Exceptthisonehasacomic(thanksRandall/xkcd.com)• Let’stalkaboutit• Manuallydoit• Thenautomateitwithanotherawesometoolofthetrade!

Page 62: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTION

• Definitelyinthewebapppenetrationtesterswheelhouse• Oneofthemorewellknownvulnerabilities• Highriskinsomecases• Riskisnotadefaultrating;contextmustbetakenintoaccount

Page 63: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLINJECTIONBASICS

• Injectionattack(OWASPtop10#1for2013)• SQLcommandsareinjectedintoaSQLstatement• Lackofsanitizationistheculprit• Poorplanning• ‘or1=1--

Page 64: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTIONDETAILS

• Canbeveryeasytofind• Reviewfuzzingoutput,lookforkeywords• MySQLError1064:YouhaveanerrorinyourSQLsyntax…• ORA-00066LOG_FILESisstringbutneedstobestringtobecompatible• MicrosoftOLEDBProviderforSQLServererror‘80040e14’• Knowyourplatform!

Page 65: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTIONDETAILS

• Canbeeasytoexploit• Manually• Automated• Askwhatisgoalis?• IhaveseenSQLi vulnerabilitiesmadetoppriorityforremediation• ConverselyIhavebeenaskedtonotexploitthem

Page 66: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTION

• Canbequitechallengingtofindaswell…• EnterBlindSQLinjection• Developerscansuppresserrors- >whoa->• Varyingdegreesofblindness• Wehavetogetsmarterwithourqueries• Alsosmarterwithourinferencing

Page 67: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTION- BLIND

• AskaseriesofTrue/Falsequestions• TimingAttacks• Bewareoffalsepositives(burpandautomatedscanningtools– cough)• Manuallyvalidateallfindings• Capitalizeonrelationshipwithdevteamorwhiteboxengagement

Page 68: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTION– INADDITION

• Canbehardtoexploit• Justbecausethereisanerrormessage,doesn’tmeantheflawisexploitable

• Justbecausewecansuccessfullyinject,doesn’tmeanthereisvalueindoingso• Contextonceagain!• Talkingaboutvaryingdegreesofblindness

Page 69: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTION– EXAMPLES

Page 70: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTION– HOWITWORKS/COMPONENTS

• Application– LAMPstack,IISand.NET,Java,Oracle,evennosql• Sloppycode• Sanitizeduserinput– notsomuch• Enduserinterface(thewebapp)• Processingcode(PHP,.NET,Java…)• DBconnection• Codereliesonuserinputandplacesitdirectlyintoquery– notuncommon

Page 71: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQL INJECTIONRISK• Dependsonthedetails• What’sinthedatabase?• Whatisthevulnerablequery?• Mitigations(permissions,IPS,WAF,SEGMENTATION)• Ultimately,informationdisclosure…• Modify,Delete,etc (insertSQLverbhere),andshell!• CIAtriad:Confidentiality(select),Integrity(modify)andAvailability(drop)

Page 72: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

WHYSOPREVALENT?

• Becauseit’sHARD!• Developingarobustwebapplicationischallenging• Manycomponents,features,movingparts• Havetokeepusershappy• Profitmattersasdoestimetomarket:Finiteamountofdevcycles• Lackoftraining• Overreliantonframework

Page 73: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

MANUALLYIDENTIFYING

• Manual…whatdoesthatmean?• Typingincommandstoaformfieldandclickingsubmit–rathermanual• Easywaytofindlowhangingfruit• Notaproficientmethodhowever• Thiswillworkforsomeattacksonsomeapplications• Soyoufindaflaw,nowwhat?

Page 74: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

MANUALEFFORTS

• Youneedtounderstandtheriskassociatedwiththatflaw• Goodtimetoreachouttoorganizationandletthemknow• Priortoexploitingit!• ThegoalisusuallynotDOSorcausingharmtothebusiness• Meaningyoudon’tnecessarilywanttodropatable

Page 75: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

AUTOMATEDTOOLS

• Plentytochoosefrom:• BBQSQL• BSQL• Pangolin(GUI)• Havij• sqlmap• Somearedated,notmaintainedandjustnotgreat

Page 76: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – THE SQL INJECTIONTOOL!

• ByfarthemostcapablefreelyavailabletoolforSQLi• Python,opensource,extensible• IntegrateswithBurpandothertools• CLI,wizard,batchmode,configurationoptionsgalore• Veryflexible• Moststableandmostlyreliableintermsofquality

Page 77: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SLQMAP OVERVIEW

• Commandlineinterface• Writteninpython• Requirespython2.6or2.7• GNUGeneralPublicLicense• Greatresourcesandinformationatgithub.com/sqlmapproject

Page 78: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – USECASES

• ManuallyfindSQLi vulnerabilityandleveragesqlmap• Useasscanningtooltofindvulnerabilities• Importresultsfromtoolintosqlmap• Usejusttoexploitaknowvulnerability• Usespecialfeaturesforaspecificscenario

• Filterbypass(WAF/IPS/mod_security,etc)• TOR

Page 79: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – HOWITWORKS

• Basicallysendstraffictowebserver• Scrutinizesresults/responses• Makesdeterminationsbasedonresults• Vulnerable– notvulnerable– WAF/IPS– orunstabletarget• Asksuserwhattodoinagivensituation

Page 80: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – EXPLOITATION

• Potentially…• Banner• Hostname• OSVersion• Users• Passwords• Datadump• Shellaccess

Page 81: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – EXPLOITOVERVIEW

• Usingfunctionalityofthedatabase,sqlmap writesbackdoortowebserver• Makesfilesexecutable(0755)• Identifiesthelocationofthefile• PassesOScommandsasparametervalue• Returnsresults• Lookslikethis…

Page 82: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – EXPLOITVIEW

Page 83: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP –DECODED

• Samething,decoded• Canyoutellwhat’shappening?

Page 84: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLMAP – LET’SCHECKITOUT

Page 85: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LAB#4SQLI

• #1LogintoKali• #2OpenBrowser(IceWeasel)• #3Browsetodenvertrainingday.com:11432/SQLiLab1.php• #4Followinstructionsonpage• Seekingsomethingmoreadvanced?Goto/ASIL.php• Feelfreetotakeabreak

Page 86: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

SQLINJECTIONRECAP

• Whatdidwelearn?• Proxysupportisawesome• Onceagainanopensourcetool– viewsourceifinterested• Anyquestionswiththislab?

Page 87: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LETSMOVEONTOTODAYSLASTTOPIC

• Client-sideattacks• Client-side– asinbrowseroruseroftheapplication• Clientsareoftenoverlookedasattackvector• Manyclientimpactingvulnerabilitiesgouncheckedonapplications• Perfectexample…

Page 88: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

HTTPS://SECURITYHEADERS.IO

Page 89: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LACKOFHEADERS

• HSTS(StrictTransportSecurity)• HPKP(PublicKeyPinning)• CSP(ContentSecurityPolicy)• X-XSS-Protection(ReflectedXSSprotectioninbrowser)• X-Frame-Options(Preventframingattacks)

Page 90: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

CLIENT-SIDE

• Attackingusersofanapplication• Commontheme• Commonattackscenario• Thinkaboutit…• Compromiseasite?• Compromise1M+usersofthesite?• Ordoboth– whicheveriseasier(asanattacker)

Page 91: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

CLIENT-SIDE– WHY?

• Takeastepbackandask:Whyattackusers?• Webapppentesting;notallaboutpoppingshells• Whatarethegoalsoftheattackers?

• Maliciousads(malvertisng)• Botnet

• Monetary

• Howcanapplicationvulnerabilitiesbeleveraged?

Page 92: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

MORECLIENT-SIDEATTACKS

• XSS(Crosssitescripting)• XSRF(CSRF)(Crosssiterequestforgery)• XFS(Crossframescripting)• Harvestingattacks• Theseallleverageservervulnerabilitiestocauseharmtoclients/users

Page 93: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

FROMPENTESTERSPERSPECTIVE

• User’sareloggedin• User’shaveaccess• User’smaybeadmins• User’sareontheLANthatcouldbeinscope• User’sareaweakspothistorically

Page 94: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

USERRISK

• IstheOSuptodatewithpatches?(probablynot)• Isthebrowseronthelatestversion?(isyours?)• Arethereanycorporaterestrictionsinplacetopreventbrowsing?(NO)• Doesyourlaptophaveamicrophoneandcamerabuilt-in?(likely)• Sowhatcouldpossiblygowrong?• Letsfindout…

Page 95: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEF – BROWSEREXPLOITATIONFRAMEWORK

• Pentestingtoolwithafocusonthebrowser• Client-sideonceagain• Allowsusto“hook”victims• Exploitbrowserbasedvulnerabilities• Beefproject.com

Page 96: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEF – OVERVIEW

• Greatforpenetrationtestingengagements(dependingonscope)• Leveragesocialengineering• Targetusers• Advancedfeatures• MaptheLAN• Integratewithmetasploit

Page 97: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEF – VISUAL

Page 98: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEF – HOWITWORKS

• Client– Servermodel• VictimconnectstoBeEF instance• Victimbrowserexecutesjs andbecomes“hooked”• BeEF cannowcontrolthe“zombie”browser• Hookdisappearsoncevictimclosestab*

Page 99: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEF – EXPLOITATION

• Variousmodulesatourdisposal• Portscanning• Networkingscanning• Stealvictimshistoryandclipboardcontents• Targetvulnerabilitiesinbrowserandplugins• Ownbox

Page 100: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEF – DEMO

• IamgoingtoneedavolunteerJ

Page 101: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

LAB#5BEEF• #1LogintoKali• #2OpenBrowser(IceWeasel)• #3Browsetodenvertrainingday.com:11432/BeEFLab1• #4Followinstructionsonpage• Seekingsomethingmoreadvanced?Goto/wheresthebeef

Page 102: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

BEEFRECAP

• Whatdidwelearn?• ThereisareasonwhypeoplelikeSergehaveducttapeovertheircameras• Javascript isPOWERFUL• Lotsofmodulesdon’twork…• Canyouthinkofrealworldscenarioswhereyouwouldusethistool?*kids

Page 103: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

WRAP-UP

• Learnedaboutsomecoolbrowserfeatures• Automatedattackswithburpandzap• Wrotesomebashscriptsutilizingnmap andNSEscripts• GotshellaccessviaablindSQLinjectionvulnerabilitywithsqlmap• HadsomefunwithBeEF• Anyquestionsaboutanythingwecoveredtoday?

Page 104: Web App Pen Testing tools of the trade - denver.issa.orgdenver.issa.org/.../Web-App-Pen-Testing-tools-of-the-trade.pdf · • Web App Pen Testing Tools of The Trade ... • OSINT

THANKYOU!

@sergeborso

https://www.linkedin.com/in/sergeborsoAndthankstoISSA


Recommended