Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL...

104
WEB APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING

Transcript of Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL...

Page 1: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

WEBAPPPENTESTINGTOOLSOFTHETRADE

ISSAALLDAYTRAINING

Page 2: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SERGEBORSONOVEMBER2016

Page 3: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

ABOUTME

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

Page 4: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

HANDS-ONLABS

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

Page 6: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

CRITICALINFORMATION

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

Page 8: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

TELLMEABOUTYOU

• Name• Occupation• Experience

• Whatyouwanttogetoutofthisclass(anddon’tsayCPEsJ )

Page 9: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

WEBAPPLICATIONS

• Whatarethey?• Appvswebsite• Howdotheywork?• CommonExamples…

Page 10: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

PENETRATIONTESTING

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

Page 11: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

TOOLS

• Whatwouldatoolbeinthiscontext?• Software!• Scripts• Specifictotheweborapplicationsornetworkconnectivity

Page 12: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform
Page 17: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

ANDTHEREST…

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

Page 18: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

TRIVIA

• Q:Whichbrowsernowoffersfreebuilt-inVPNsupport?• Meaningyouopenyourbrowser,clickabuttonandconnecttoaVPN

• A:Operaasofabout2monthsabout…anditworkswell!

Page 19: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

THEGOALOFGETTINGTOKNOWYOURBROWSER

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

• Whatdoesthatmean?• Ifyouaregoingtodosomething,doitwell

Page 21: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BROWSERRECAP

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

Page 23: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

INTERCEPTIONPROXIES

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

Page 24: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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

Page 25: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

PROXYVIEW

Page 26: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

PROXYVIEW

Page 27: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

INTERCEPTIONPROXYSPECIFICS• Potenttoolforourarsenal• Youcangetbywithabrowserandaproxyformajorityofthetesting(dependingonscope)

• Theproxyiswhereautomationcomesintoplay• Andattacks:• Malicioustraffic• Fuzzing• Identifyingvulnerabilities

Page 28: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

VULNERABILITIESWECANEXPECTTOFIND

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

Page 29: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SPEAKINGOFVULNERABILITIES

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

Page 30: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

HOWDOWEFINDTHESEVULNERABILITIES?

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

Page 32: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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

Page 33: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

MAPPING

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

• Aproxywillautomatethisandmakeusawareofeverythingitcanfind

Page 34: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SCANNINGANDFUZZING

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

Page 35: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

LASTSTEP(S):EXPLOITATIONANDSTARTOVER

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

Page 36: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BACKTOTHEPROXY

Page 37: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

ZAPVIEW

Page 38: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

LEVERAGINGAPROXY

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

Page 39: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

PROXYDEMO:SCANNINGANDFUZZING

• Goalistoshowhowtouseabrowser&proxytoscanandfuzzatarget

Page 40: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

PROXYRECAP

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

Page 42: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

NMAP

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

Page 44: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SOMENMAP EXAMPLES

Page 47: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SOMENSE EXAMPLES

Page 48: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

ANOTHERMULTIFUNCTIONTOOL:BASH

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

Page 50: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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

Page 53: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

USINGABROWSER

Page 55: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BASHBASICS

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

Page 56: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLINJECTION

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

Page 62: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQL INJECTION

• Definitelyinthewebapppenetrationtesterswheelhouse• Oneofthemorewellknownvulnerabilities• Highriskinsomecases• Riskisnotadefaultrating;contextmustbetakenintoaccount

Page 63: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLINJECTIONBASICS

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

Page 64: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQL INJECTIONDETAILS

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

Page 66: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQL INJECTION

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

Page 67: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQL INJECTION- BLIND

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

Page 68: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQL INJECTION– INADDITION

• Canbehardtoexploit• Justbecausethereisanerrormessage,doesn’tmeantheflawisexploitable

• Justbecausewecansuccessfullyinject,doesn’tmeanthereisvalueindoingso• Contextonceagain!• Talkingaboutvaryingdegreesofblindness

Page 69: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQL INJECTION– EXAMPLES

Page 70: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

WHYSOPREVALENT?

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

Page 73: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

MANUALLYIDENTIFYING

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

Page 74: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

MANUALEFFORTS

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

Page 75: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

AUTOMATEDTOOLS

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

Page 76: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SLQMAP OVERVIEW

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

Page 78: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLMAP – HOWITWORKS

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

Page 80: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLMAP – EXPLOITATION

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

Page 81: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLMAP – EXPLOITOVERVIEW

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

Page 82: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLMAP – EXPLOITVIEW

Page 83: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLMAP –DECODED

• Samething,decoded• Canyoutellwhat’shappening?

Page 84: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLMAP – LET’SCHECKITOUT

Page 85: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

SQLINJECTIONRECAP

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

Page 87: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

LETSMOVEONTOTODAYSLASTTOPIC

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

Page 88: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

HTTPS://SECURITYHEADERS.IO

Page 89: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

CLIENT-SIDE

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

Page 91: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

MORECLIENT-SIDEATTACKS

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

Page 93: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

FROMPENTESTERSPERSPECTIVE

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

Page 94: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

USERRISK

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

Page 95: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BEEF – BROWSEREXPLOITATIONFRAMEWORK

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

Page 96: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BEEF – OVERVIEW

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

Page 97: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BEEF – VISUAL

Page 98: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BEEF – EXPLOITATION

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

Page 100: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BEEF – DEMO

• IamgoingtoneedavolunteerJ

Page 101: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

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.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

BEEFRECAP

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

Page 103: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

WRAP-UP

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

Page 104: Web App Pen Testing tools of the trade - denver.issa.org APP PEN TESTING TOOLS OF THE TRADE ISSA ALL DAY TRAINING ... • OSINT • Google searches ... • We need to know the platform

THANKYOU!

@sergeborso

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