the code behind the vulnerability - owasp foundation€¦ · xss in asp.net core with raw html...

49
The Code Behind The Vulnerability (v3) Barry Dorrans .NET Security Czar https://idunno.org

Upload: others

Post on 06-Jun-2020

40 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

TheCodeBehindTheVulnerability(v3)BarryDorrans.NETSecurityCzarhttps://idunno.org

Page 2: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

WhoamI.NETSecurity“Czar”WhichmeansIannoyeveryoneaboutcodingsecurelyAndIgettodealwithitwhenImissthingsIalsorambleandswearontwitterinanon-workapprovedmanner@blowdart

Page 3: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Whatyoucanexpect7MSRCbulletinsandwhatlaybehindthem

Andafewthingswecaughtbeforetheycausedabulletin.

UnicodeandhowtoabuseitMisusingencryptionZipfilesandrunawayprocessesNaïvecertcomparisonsXSSviaURLvalidation

Page 4: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

7TalesofMSRCCases

Page 5: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

TheMicrosoftBulletinProcess.§Vulnerabilityreported§MSRCopencase§ProductGroupSecurityemailed

§Reproductionattempted§ReproductiontestedagainstallsupportedOS/softwareconfigurations

§Fixdeveloped§Fixtested§Bulletinwritten§Fixdeployedinternally§Bulletinandfixreleased

Page 6: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

SecurityBulletinsHashDoS (MS11-100/CVE-2011-3141)PaddingOracle(MS10-070/CVE-2010-3332)SharePointViewState RCE(MS13-067/CVE-2013-1330)InfiniteRegexDoS (MS15-101/CVE-2015-2526)XSSinASP.NETCorewithRawHTML(CVE-2018-0784)Griefing viaCSRF(CVE-2018-0785)MalwareviaWSDL(CVE-2017-8759)

Page 7: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HashDoS (CVE-2011-3141)ADenialofServicecausedbyparsingFORMinputs.CausedbyHashTable andDictionaryusingapredictablehashalgorithmforstringkeys.Fixedbyswitchinghashfunctionstoonethatisunpredictableorlimitingdictionarysize.

Page 8: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HashDoS explainedAllformfieldsbeginningwithAwouldgointoslotA.

Togetavaluebackyougototheslotandlookthrougheverything.ThemoreAfieldstherearethelongerittakes.

IfyoucanforceeverythingintoasingleslotthenlookupswilltakemoreandmoreCPUwhichleadstoDoS.Originallypresentedat28c8(28thChaosCommunicationCongress)2011.Alexander“alech”KlinkandJulian“zeri”Wälde exploitedPHP,Java,Python,JavaScript.

Page 9: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

DIYHashDoSDictionary<TKey>fixonlyappliestostringkeys.Ifyouallowuserinputintoahashbasedcollectionwhichhasakeywhichisn’tstringandyourGetHashCode()algorithmforthekeyclassispredictablethenyouarevulnerable…

Page 10: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HashDOSDemo

Page 11: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?Don’tuseuserinputaskeysindictionariesunlessTheuserinputisastringORTheHashCode fortheinputisstrongandyouimplementasessionkey;eg.SHA1HMACwitharandomkeysetatruntime.

Page 12: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

PaddingOracle(CVE-2010-3332)Informationdisclosureviacryptographicattack.Anendpointwasexposedwhichvalidatedifastringwasencryptedcorrectly.Theattackercouldusetheyesornoresulttobuildproperlyencryptedstringswithoutknowingthekey.Thisthenallowedforgedrequeststoscriptresource.axd andserveupanyfileinthewebapplication,likeweb.config,whichcontainsmachinekeys,whichyoucanforgeauth ticketswith.Fixedbyhavingscriptresource.axd validatesignaturesandserveJSonly.

Page 13: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

PaddingOracleExplainedEncrypteddataisoftenpaddedtomeetalgorithmrequirements.Sidechannelattackcanbeusedtodiscoverthepaddingiscorrect.Thiscanthenleadtofastdecryption– youtweakasinglebyteandask“Isthispaddingcorrect?”.Fromthereyoucancalculatetheoriginalcharacter.OriginallypresentedatEUROCRYPT2002,SergeVaudenay againstCBCmodeinSSL,IPSEC

ExpandedtoASP.NETbyThaiDuong,JulianoRizzoatIEEESymposiumonSecurityandPrivacy2011.

Page 14: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?Don’texposepaddingoracles.Addaauthenticatedsignaturetotheencrypteddata,andvalidateit.

Page 15: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

SharePointViewState RCE(CVE-2013-1330)RemotecodeexecutionviaSerialization.MadepossiblebySharePointdisablingViewState MAC.FixedbyturningViewState MACon.DiscoveredbyAlexandreHerzog,presentedatArea41in2013.ExpandedbyAlexandretodemonstrateRCEifmachinekeyisknown.Expandsonaremoting exploitdiscoveredbyJamesForshawandpresentedatBlackHat2012.

Page 16: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

RCEviaViewStateViewState is,bydefault,signed.Ifitisnotsigned,orthesigningkeyisknownyoucanforgeViewState tocontainarbitraryobjects.ViewState isimplicitlytrustedandobjectsembeddedinitgetcreatedwhenit’sparsed.

Page 17: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

DeletingfileswithViewState.NETcontainsaTempFileCollection classwhichisserializable.SerializableclassescanbestoredinViewStateTheclasscleansupfileswhentheclassisGCed.Youcouldsetthefilenamesinthecollectionfromaserializedrepresentation…

Page 18: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Viewstate /SerializationDemo

Page 19: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?Whenyouroundtripstatetoausercontrolledspacesignthedata.Don’tpublishyoursigningkey.

Page 20: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

InfiniteRegex(CVE-2015-2526)DoS againstvalidatorswithcraftedinput.MadepossibleduetoabacktrackingRegexand.NETnotputtingatimeoutonregularexpressionsbydefault.Fixedbyaddingtimeouts.DiscoveredbyRobertoSuggi,reportedinApril2015.

Page 21: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

InfiniteRegexDemo

Page 22: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?Findabetterwaytovalidatethanregularexpressions.Settimeoutsonallregularexpressions.Setaglobalregextimeout.AppDomain.CurrentDomain.SetData(

"REGEX_DEFAULT_MATCH_TIMEOUT",

TimeSpan.FromSeconds(1));

Page 23: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

XSSinASP.NETCore(CVE-2018-0784)MVCencodeseverypieceofoutputbydefault.Exceptwhenyoutellitnotto.Andwetolditnotto.Whichwouldhavebeenok…but…DiscoveredbyKévinChalet,reportedin2017.

Page 24: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

XSSviaOverbindingDemo

Page 25: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?Don’tuseHtml.Raw.Searchyourcodeforit.Forthingsshouldnevercomefromuserinputapply[BindNever].Ifsomethingisgeneratedserverside,alwaysgenerateserverside,stopputtingitinahiddenfieldtotransportitbetweenrequests.

Page 26: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

CSRFinASP.NETCore(CVE-2018-0785)CSRFallowsanothersitetoactonbehalfofaloggedinuser.ASP.NETCoreMVCautomaticallyaddstokenstoallHTMLformstopreventthis.Whichdoesn’thelpwhenit’snotaform.DiscoveredbyKévinChalet,reportedin2017.

Page 27: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?GETshouldbeidempotent.(ResubmittingaGETshouldn’tchangetheresults)WhenyouchangestateuseaPOST.

Page 28: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

WSDLabuse(CVE-2017-8759)Nationstateattack.WSDLismetadataforSOAPendpoints.Usedtogenerateproxyobjects.Didyouknow.NETFrameworkhasaWSDLparserwhichgeneratescode?DiscoveredbyFireEye,reportedin2017.

Page 29: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

WSDLabuse(CVE-2017-8759)IsValidUrl()insidetheparserhadabug.ThisenabledanationstatetargetingRussianspeakersinanotherEasternEuropecountrytocompilecodeontheirmachine.ItwasactivatedviaWord’sSOAPmonikerfunctionalitythatstartsoff.NETwithnouserinteraction,parsesWSDLandthencanconnecttoaSOAPendpoint.

Page 30: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

HowcanIfixthis?Don’tbeacountryRussiawantstoinvade(orhaspartiallyinvaded).Don’teverwritecodethatgeneratescodefromuserinput,thencompilesandrunsit.

Page 31: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Mistakeswe’veseen

Page 32: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

BadencodingWhat’swrongwith?string.Format(

"onmouseover=\"DisplayTooltip('Issue: {0}');\"" +"onmouseout=\"DisplayTooltip('');\"",HttpUtility.HtmlEncode(d["Title"]);

EncodingiscontextspecificandhardtogetrightonceJavaScriptisinvolved.BettertosetthevalueinaDIVHTMLEncodedthenpulloutcontents.<div data-stuff="{@Title}" />

Page 33: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

IİCaptainWhatwillthefollowingprint?const string input = "interesting";bool comparison = input.ToUpper() == "INTERESTING";Console.WriteLine("These things are equal: " + comparison);

Peoplemakesecuritydecisionsbasedonstringcomparisons.Usestring.Compare(a, b, StringComparison.OrdinalIgnoreCase)There’sacodeanalysisruleforthis– CA1309

Page 34: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

TurkishIDemo

Page 35: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

It’snotjustTurkeyIfyouhaveaCultureInfo ofth_TH.UTF8StartsWith(".") crashesaprocessonMac&LinuxbecauseThaihasnopunctuationmarks.ISO/IEC14651:http://unicode.org/L2/L2006/06105-02n3847-14651-2001-fdam3.pdf (AnnexC2.1)

“Nosyllablestructureorwordboundaryanalysisisrequired,asThailexiconsareorderedalphabetically,notphonetically.NotethatThainormallydoesnotuseanywordseparator,except,andexceptionally,zerowidthspace.“

Page 36: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Wide<Unicodehas“fullwidth”characters<becomes<< is&#xfeff;&#xff1c;Browsersignorethis,so<script> isn’tXSSHoweverifput< intoaSQLvarchar fielditgetsconvertedto<AndnowyouhavepersistedXSSSodon’tuseanonUnicodecolumntostoreUnicodecharacters.(Anddon’ttrustdatacomingfromSQL– HtmlEncode it!)

Page 37: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Commoncryptographymistakes“Thisisbase64encrypted.”“Ihavethisgreatnewalgorithm.”Key/IVreuse– whenadocument/resourcechanges,changeKey/IV.Keyshavepurposes.Don’treusekeysacrosspurposes.Encrypteddatamusthavemessageauthentication.Hashedcombinedstringerrorsbuiltin+securely == built+insecurelyPreferhash(len(a) + hash(a) + len(b) + hash (b))Certificateverificationbyhostnamealone.

Page 38: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

PathTransversalFileupload– RFC1867The original local file name may be supplied as well, either as a 'filename' parameter either of the 'content-disposition: form-data' header or in the case of multiple files in a 'content-disposition:file' header of the subpart.

Ofcourseifyouedittherequestbeforeitleavesthebrowser…Useauniquename.Generateityourself.Ifyouhavetokeepitusesomethinglikestring filename =

System.IO.Path.GetFileName(userProvidedFileName);string fullPath = Server.MapPath(

System.IO.Path.Combine(@"d:\inetpub\inbound\",filename));

Page 39: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

ZipbombsWhenacceptinguserfilesforparsingit’seasytoevil.Zipbombs– tinyfilewhichrecursivelyuncompresses.e.g.42.zip- zipfileconsistingof42kilobytesofcompresseddata,containingfivelayersofnestedzipfilesinsetsof16,eachbottomlayerarchivecontaininga4.3gigabytefileforatotalof4.5petabyteswhenuncompressed.

Page 40: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

BillionlaughsXMLhasthesameproblem.BillionLaughsdefines10entities,eachofwhichisdefinedasconsistingof10ofthepreviousentitiesetc.thedocumentbeingasingleinstanceofthelargestentity,whichcontainsonebillioncopesofthefirstentity.<?xml version="1.0"?><!DOCTYPE lolz [<!ENTITY lol "lol"><!ELEMENT lolz (#PCDATA)><!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;"><!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;"><!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;"><!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;"><!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;"><!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;"><!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;"><!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;"><!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">

]><lolz>&lol9;</lolz>

PreventablebyturningoffDTDParsing

Page 41: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Thingswedoforyouandacoupleofthingswedon’t.

Page 42: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Opt-intoprotectionsBackcompat meansyouneedtoopt-intocertainbreakingchanges.TooptintoASP.NET4.5behaviors,setthefollowinginweb.config<machineKey compatibilityMode="Framework45" />

Or(whichiswhattheASP.NET4.5projecttemplatesdo)<httpRuntime targetFramework="4.5" />

Page 43: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Stringhashcode randomisationTohelpagainstHashDOS wecanrandomizehashcodes.Wedon’tdothisbydefaultinthe.NETFrameworkbecausepeoplesavehashcodes eventhoughweneverpromisedthey’dbeconstant.

<configuration><runtime><UseRandomizedStringHashAlgorithm enabled=1 />...

</runtime></configuration>

Page 44: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

DataProtectorASP.NET4.5introducesMachineKey.Protect andUnprotectThisreplacesEncodeandDecodewhichallowedadevelopertochoosebetweenSign,EncryptorBoth.It’snowalwaysboth.Aimedatephemeraldata.ASP.NETCorereplacesitwithDataProtector

Page 45: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

StopusingthisPartialTrust-https://support.microsoft.com/kb/2698981RequestValidationMachineKey.Encode &MachineKey.Decodehttp://www.asp.net/aspnet/overview/web-development-best-practices/what-not-to-do-in-aspnet,-and-what-to-do-instead#security

Page 46: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Breakingpartialtrustdemo

Page 47: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

Thescarydemo

Page 48: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

InsummarySignyourdata,evenwhenit’sencryptedDon’tuseregularexpressionsDon’tuseBinaryFormatterDon’toverbindUsetherightverbOpt-intonewprotections

Page 49: The code behind the vulnerability - OWASP Foundation€¦ · XSS in ASP.NET Core with Raw HTML (CVE-2018-0784) Griefingvia CSRF (CVE-2018-0785) Malware via WSDL (CVE-2017-8759) Hash

©2015MicrosoftCorporation.Allrightsreserved.Microsoft,Windows,andotherproductnamesareormayberegisteredtrademarksand/ortrademarksintheU.S.and/orothercountries.TheinformationhereinisforinformationalpurposesonlyandrepresentsthecurrentviewofMicrosoftCorporationasofthedateofthispresentation.BecauseMicrosoftmustrespondtochangingmarketconditions,itshouldnotbeinterpretedtobeacommitmentonthepartofMicrosoft,andMicrosoftcannotguaranteetheaccuracyofanyinformationprovidedafterthedateofthispresentation.MICROSOFTMAKES NO WARRANTIES,EXPRESS,IMPLIEDORSTATUTORY,ASTOTHEINFORMATIONINTHISPRESENTATION.