Context
In our development team, we have to build a component. This component is a full client side one written in Javascript.
A client web application wishing to embed this component will call it like below:
<iframe id="fullScreenIframe" src="http://my-server.com/component?param1=val1¶m2=..."></iframe>
The problem
One of the parameters accepted by the component makes some of us nervous. The origin
parameter is used to generate a link to take the user back to the client web application.
Here is how the component manages this parameter:
$(document).ready(function() {
var origin = urlParameters["origin"];// Dynamically built from the current document url
if(origin != undefined){
// The link to take the user back...
$("#welcomePage").attr("href",origin);
// Another link in the breadcrumb using the same `origin` parameter
$("#simulationPage").attr("href", "index.html"+"?origin="+origin);
}
// ...
}
What we already told him
- Website phishing
Even if the origin
parameter is passed to jQuery, any website can be used in a phishing scam. A user can be asked to (re)enter their credentials thinking they are on a real site. The hole here will be the component.
- Allowlist with valid values
The valid values of origin
can be stored remotely in an allowlist. The component would check the allowlist first before generating the link. A default link can be generating if an unexpected value is found.
Those two arguments didn't convince him. He wants to be demonstrated that the origin
parameter can be a security hole. What would you tell him?
By the way, I'm looking for a good PoC demonstrating the weakness of the origin
parameter.