This repository was archived by the owner on Dec 19, 2023. It is now read-only.
Fixing CORs Issue That Allows Unautharized Access To The Teedy Instance Via CSRF Adding User. #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📊 Metadata *
Bounty URL: https://www.huntr.dev/bounties/2-other-docs/
⚙️ Description *
docs-webis Usingdocs-web-commonsFor Multiple Things. Including The CORs Filter. Indocs-web-commonCORs Filter. You're Returning The Value Of Therequest.getHeader("origin")On TheAccess-Control-Allow-OriginHeader. That Allows Any Site On The World To Send HTTP Requests To The Instance And Read The Response SinceAccess-Control-Allow-CredentialsIs Set Totrue. Before Using The CORs Under/api/*You're Checking If The Application is On Development First. Okay, The Problem Is That Every Manual Builds Are Used Withapplication.mode,dev. The Users Have To Change That Frompom.xmlBut Nothing Is Pointed About It. The Cors Misconfig Can Lead To Sirius Issues. In This Case Attackers Are Able To Add Users Into The Instance With Their Own Credentials Then Login With It And Gain Access To The Teedy Instance. Even On Dev Mode. Developers Won't Need Such Thing. They Can Just Temp. Disable Chrome Protections. The Way You're Handling CORs Isn't Secure. See The Bounty URL. For The Hall Issue Description With a Proof Of Concept For The Instance Takeover.💻 Technical Description *
The Fix I Added Was Changing
response.addHeader('Access-Control-Allow-Credentials' , 'true')Intoresponse.addHeader('Access-Control-Allow-Credentials' , 'false')On CORsfilter.java To Disable Sending Credentials With The XHR Requests.You Can Apply Other Fixes Like. Adding an Array With Allowed Hosts. Then Check If
originHeader Is One Of Them. If It's Then Reflect The Origin And Allow Credentials. If It's Not. Then Reflect The Origin Without Credentials Allowed. Tell Me If You Want Me To Apply This Fix. I Can Change The Files Before The PR Getting Accepted/Rejected.🐛 Proof of Concept (PoC) *
{HOST}With Your Own Teedy Instance Host. Then View On Browser > Click The Button. And Another User Will Be Added To Your Instance And You Will Be Able To Login With:tester:password123🔥 Proof of Fix (PoF) *
👍 User Acceptance Testing (UAT)
🔗 Relates to...