Skip to main content
Level 1
Apr 22, 2022 3:04 PM UTC
Solved

JavaScript redirects security issue - how do I do this correctly?

My web developer flagged this to me and I have never seen this from MKTO redirects. Anyone else experience this or have a solution? MKTO support wasn't very helpful on this one 😞

"Last week the security team flagged a couple of redirects associated with Marketo that can be escalated to XSS attacks."
 
erp.financialforce.com/redirect?url=https://www.google.com
backoffice.financialforce.com/app/redirect?url=https://www.google.com
backoffice.financialforce.com/redirect?url=https://google.com
erp.financialforce.com/redirect#?url=https://www.google.com
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Apr 22, 2022 5:15 PM UTC

This merely means that you haven’t created your redirect page properly (it’s not the native Marketo redirect you’re using here, but rather bouncing people off your interstitial LP using custom JavaScript).

 

Whenever you do this, you must have an “allow list” of origins (protocols + hostnames):

let allowedOrigins = [ 'http://pages.example.com', 'http://www.example.com', 'http://example.com' ];

 

You compare the redirect origin (i.e. the origin of the next-hop URL that’s being wrapped inside the query string) to the list of allowed origins.

 

If it’s not in the list, you don’t redirect. Simple as that.

1 reply

SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Apr 22, 2022 5:15 PM UTC

This merely means that you haven’t created your redirect page properly (it’s not the native Marketo redirect you’re using here, but rather bouncing people off your interstitial LP using custom JavaScript).

 

Whenever you do this, you must have an “allow list” of origins (protocols + hostnames):

let allowedOrigins = [ 'http://pages.example.com', 'http://www.example.com', 'http://example.com' ];

 

You compare the redirect origin (i.e. the origin of the next-hop URL that’s being wrapped inside the query string) to the list of allowed origins.

 

If it’s not in the list, you don’t redirect. Simple as that.

Translate