securing your grails app - beyond authentication & authorization

98

Upload: spring-io

Post on 02-Jul-2015

724 views

Category:

Software


0 download

DESCRIPTION

Application security is not a concern that we can ignore. Vulnerabilities come from various angles, but it is important to stay aware and vigilant so we can recognize and thwart threats.

TRANSCRIPT

Page 1: Securing Your Grails App - Beyond Authentication & Authorization
Page 2: Securing Your Grails App - Beyond Authentication & Authorization

ColinHarringtonPrincipalConsultant

[email protected]

@ColinHarrington

Page 3: Securing Your Grails App - Beyond Authentication & Authorization

Thistalkismeanttodiscusssecurityissuesinthespiritofhelpingthosewhobuildsystemsmakestable,secure

webapplications.

Page 4: Securing Your Grails App - Beyond Authentication & Authorization
Page 5: Securing Your Grails App - Beyond Authentication & Authorization
Page 6: Securing Your Grails App - Beyond Authentication & Authorization
Page 7: Securing Your Grails App - Beyond Authentication & Authorization
Page 8: Securing Your Grails App - Beyond Authentication & Authorization
Page 9: Securing Your Grails App - Beyond Authentication & Authorization
Page 10: Securing Your Grails App - Beyond Authentication & Authorization
Page 11: Securing Your Grails App - Beyond Authentication & Authorization

HappyPathEasiestthingpossibleMVP

Nounauthorizedaccess.HardenedTested

Page 12: Securing Your Grails App - Beyond Authentication & Authorization

Grandma'scatphotosYourblogStaticcontent

BankingHealthinformation

GovernmentBigbusiness

Paymentsystems

Page 13: Securing Your Grails App - Beyond Authentication & Authorization

$$$oflosspotentialOfficeSpaceLossofconsumerconfidence

RestorethebackupMaybeafewcommentslost

sincelastbackupNoanimalswereharmed

Grandmacriesforaminute

Page 14: Securing Your Grails App - Beyond Authentication & Authorization
Page 15: Securing Your Grails App - Beyond Authentication & Authorization
Page 16: Securing Your Grails App - Beyond Authentication & Authorization
Page 17: Securing Your Grails App - Beyond Authentication & Authorization
Page 18: Securing Your Grails App - Beyond Authentication & Authorization

(butverify)

Page 19: Securing Your Grails App - Beyond Authentication & Authorization
Page 20: Securing Your Grails App - Beyond Authentication & Authorization
Page 21: Securing Your Grails App - Beyond Authentication & Authorization
Page 22: Securing Your Grails App - Beyond Authentication & Authorization
Page 23: Securing Your Grails App - Beyond Authentication & Authorization
Page 24: Securing Your Grails App - Beyond Authentication & Authorization

Non-profitgroupNamingborrowedCheckouttheirrecommendations

Page 25: Securing Your Grails App - Beyond Authentication & Authorization
Page 26: Securing Your Grails App - Beyond Authentication & Authorization

#1issueontheweb

"SELECT*FROMaccountsWHEREcustID='"+params.id+"'"

http://example.com/app/accountView?id='or'1'='1

Page 27: Securing Your Grails App - Beyond Authentication & Authorization
Page 28: Securing Your Grails App - Beyond Authentication & Authorization
Page 29: Securing Your Grails App - Beyond Authentication & Authorization
Page 30: Securing Your Grails App - Beyond Authentication & Authorization
Page 31: Securing Your Grails App - Beyond Authentication & Authorization

Stringhql="""fromAccountHolderwhereusername='$username'andpassword='$password'"""

defrow=AccountTransaction.executeQuery(hql)

Page 32: Securing Your Grails App - Beyond Authentication & Authorization

admin'ANDsubstring(password,0,1)==char(64)AND'1'='1

http://security.stackexchange.com/questions/24265/hql-injection-example

Page 33: Securing Your Grails App - Beyond Authentication & Authorization
Page 34: Securing Your Grails App - Beyond Authentication & Authorization
Page 35: Securing Your Grails App - Beyond Authentication & Authorization

Orbettertestedsanitizationtools

Page 36: Securing Your Grails App - Beyond Authentication & Authorization
Page 37: Securing Your Grails App - Beyond Authentication & Authorization

Grails1.3.7(pre1.3.8)

classMyDomainObject{defSpringSecurityService...}

Page 38: Securing Your Grails App - Beyond Authentication & Authorization
Page 39: Securing Your Grails App - Beyond Authentication & Authorization

“cpimg.png./archive/$filename”.execute()

Page 40: Securing Your Grails App - Beyond Authentication & Authorization

log.info“userbenignsaid${message}”

http://example.com/thing/action?message=[ERROR]Adminpasswordhasexpired!!OHCRAPHELP

Page 41: Securing Your Grails App - Beyond Authentication & Authorization

deftransfer(Transfertfr){Depositd=newDeposit(amount:tfr.amt)d.save()

Withdrawalw=newWithdrawal(amount:tfr.amt,description:tfr.desc)w.save()}

Page 42: Securing Your Grails App - Beyond Authentication & Authorization
Page 43: Securing Your Grails App - Beyond Authentication & Authorization
Page 44: Securing Your Grails App - Beyond Authentication & Authorization
Page 45: Securing Your Grails App - Beyond Authentication & Authorization

http://example.com/sale/saleitems;jsessionid=2P0OC2JDPXM0OQSNDLPSKHCJUN2JV?dest=Hawaii

Page 46: Securing Your Grails App - Beyond Authentication & Authorization

UnencryptedtransportsAccountsignupForgotpasswordPasswordhintexposureInsecureSSO

Page 47: Securing Your Grails App - Beyond Authentication & Authorization
Page 48: Securing Your Grails App - Beyond Authentication & Authorization
Page 49: Securing Your Grails App - Beyond Authentication & Authorization
Page 50: Securing Your Grails App - Beyond Authentication & Authorization
Page 51: Securing Your Grails App - Beyond Authentication & Authorization

xkcd.com/936/

Page 52: Securing Your Grails App - Beyond Authentication & Authorization
Page 53: Securing Your Grails App - Beyond Authentication & Authorization
Page 54: Securing Your Grails App - Beyond Authentication & Authorization
Page 55: Securing Your Grails App - Beyond Authentication & Authorization

reviewText="""ExcellentProduct</div><iframesrc="myadnetwork.com/pwnage.html"/><h1>InjectedDOM</h1><divclass='review'>Goodwork"""

view.gsp(codec=none)

<divclass='review'>${reviewText}</div>

Page 56: Securing Your Grails App - Beyond Authentication & Authorization

Defaultcodec=HTMLnowCarefulwhendoingyourownTagLibsAntiSamy

Page 57: Securing Your Grails App - Beyond Authentication & Authorization
Page 58: Securing Your Grails App - Beyond Authentication & Authorization

Directexecution

eval()window.execScript()/function()/setInterval()/setTimeout()script.src(),iframe.src()

Page 59: Securing Your Grails App - Beyond Authentication & Authorization

document.write(),document.writeln()elem.innerHTML=dangerelem.outerHTML=dangerelem.setAttribute(“dangerousattribute”,danger)

Page 60: Securing Your Grails App - Beyond Authentication & Authorization

CookiesinsomebrowsersLocalStorageReverseJavaScriptShellsStackedMore..

Page 61: Securing Your Grails App - Beyond Authentication & Authorization
Page 62: Securing Your Grails App - Beyond Authentication & Authorization
Page 63: Securing Your Grails App - Beyond Authentication & Authorization
Page 64: Securing Your Grails App - Beyond Authentication & Authorization

https://example.com/account/123

https://example.com/account/999

Page 65: Securing Your Grails App - Beyond Authentication & Authorization

FiltersACLPermissions

Page 66: Securing Your Grails App - Beyond Authentication & Authorization

OwnershiplevelcheckingAuthorization

Page 67: Securing Your Grails App - Beyond Authentication & Authorization
Page 68: Securing Your Grails App - Beyond Authentication & Authorization

...forexample

Page 69: Securing Your Grails App - Beyond Authentication & Authorization
Page 70: Securing Your Grails App - Beyond Authentication & Authorization
Page 71: Securing Your Grails App - Beyond Authentication & Authorization
Page 72: Securing Your Grails App - Beyond Authentication & Authorization
Page 73: Securing Your Grails App - Beyond Authentication & Authorization
Page 74: Securing Your Grails App - Beyond Authentication & Authorization
Page 75: Securing Your Grails App - Beyond Authentication & Authorization
Page 76: Securing Your Grails App - Beyond Authentication & Authorization

socat-vtcp-listen:8080,forktcp:localhost:80

Page 77: Securing Your Grails App - Beyond Authentication & Authorization

Poorsalting

Page 78: Securing Your Grails App - Beyond Authentication & Authorization
Page 79: Securing Your Grails App - Beyond Authentication & Authorization
Page 80: Securing Your Grails App - Beyond Authentication & Authorization
Page 81: Securing Your Grails App - Beyond Authentication & Authorization

Notshowingthelinksdoesn'tmeanitisprotectedAssumingauserisloggedindoesn'tmeantheyshouldhaveaccesstoeverything

Page 82: Securing Your Grails App - Beyond Authentication & Authorization
Page 83: Securing Your Grails App - Beyond Authentication & Authorization

<imgsrc="http://example.com/app/transferFunds?amount=1500&destinationAccount=attackersAcct#"width="0"height="0"/>

Page 84: Securing Your Grails App - Beyond Authentication & Authorization

URLMappingsallowedMethods

Page 85: Securing Your Grails App - Beyond Authentication & Authorization
Page 86: Securing Your Grails App - Beyond Authentication & Authorization
Page 87: Securing Your Grails App - Beyond Authentication & Authorization
Page 88: Securing Your Grails App - Beyond Authentication & Authorization
Page 89: Securing Your Grails App - Beyond Authentication & Authorization
Page 90: Securing Your Grails App - Beyond Authentication & Authorization
Page 91: Securing Your Grails App - Beyond Authentication & Authorization
Page 92: Securing Your Grails App - Beyond Authentication & Authorization
Page 93: Securing Your Grails App - Beyond Authentication & Authorization
Page 94: Securing Your Grails App - Beyond Authentication & Authorization
Page 95: Securing Your Grails App - Beyond Authentication & Authorization
Page 96: Securing Your Grails App - Beyond Authentication & Authorization

AppleSSLissueOSX/iOS

Page 97: Securing Your Grails App - Beyond Authentication & Authorization
Page 98: Securing Your Grails App - Beyond Authentication & Authorization