Just trying to figure out if the following plan exposes us to a security threat:

  • We have defined a public REST Service that will accept POST requests.
  • The above requests will create Image__c records that have a Url__c pointing to our external site.
  • We plan to merge these values into either an img or apex:image tag.

My questions are:

  • Does the above pattern expose us to XSS? If so, is it Stored XSS or Reflected XSS?
    • (I think it does expose us to the former)
  • What steps should we take to lock down the REST Service?
  • What other steps can we take to ensure we are using safe resources?
  • If we follow such steps, can we be sure we are not at risk for injection vulnerabilities?

I am not a security expert and this falls outside the scope of this forum, but...

  1. Yes, this certainly puts you at risk of XSS. Specifically, a man-in-the-middle attack that generates urls pointing to malicious domains.
  2. You should probably have reverse authentication for your service - e.g., a signed HTTPS cert that you verify.
  3. If all img urls are at a particular domain, you should likely nix the domain in the response.
  4. If you can guarantee you're hitting the proper service, you guarantee your img domain is secure (also reverse auth), and you guarantee you're only hitting that domain, I think you should be ok (as far as XSS on this goes), but I am not an expert.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.