Preventing Cross Site Scripting and Request Forgery Threats in Your Business’s Social Media Campaigns
Retailers are increasing their reliance on social media platforms to further engage with their customers and partners. According to a UMass – Dartmouth social media study, over 75% of Fortune 500 companies use social media sites such as LinkedIn, Facebook and Twitter to reach customers with promotions and deals, as well as to engage and recruit potential new customers and employees. This progress is advantageous on many levels, but it does introduce fertile new ground on which attackers can launch exploitation and data gathering attacks, given the relatively open nature of social media presences.
XSS and Your Web API
Perhaps the most notable of these data gathering and exploitation attacks are cross site scripting (XSS). Once thought to be rudimentary at best, XSS has evolved to take advantage of web APIs (or web application programming interfaces) which are prevalent in all modern day social media networks, such as Facebook, Instagram and Twitter.
Web APIs, which allow software to interact with a website or web based software, are used extensively by most major websites, such as Google and Facebook, in most every function they perform. For example, did you ever notice how many websites allow you to authenticate to them by clicking on a “log in with Facebook” button? That is thanks to Facebook’s web API.
Web APIs will define a set of rules regarding software and other website interactions to govern what information is shared and how it is transmitted. The information is then accessed and used by the connected application or website, allowing for free use of data.
A Hypothetical Scenario
This generates concern among retailers who rely on social media outlets that use vulnerable web APIs. While the number of retailers using sites like Facebook for direct sales is rare, smaller retailers often use the site to make products and services readily available for purchase, which can put customer account and credit card information at risk.
Some retailers can even be hit by these exploits on their own sites, after a customer with an XSS-infected browser accesses their page. For example, Retailer X posts a 50%-off clearance ad on Facebook that is only obtainable when the customer clicks on that Facebook post. The customer clicks on the post and is directed to Retailer X’s website. However, unknown to the user, an XSS has executed a script to gather all of the customers keystrokes on Retailer X’s website. If the customer logs into the site, or enters in their credit card information, this information is passed onto the attackers through the compromised web API. Retailer X has failed its customer by not keeping their data safe, which will inevitably lead to bad PR and a loss in customer loyalty.
How Champion Can Help Prevent Attacks
The big question we are asked by retailers is how they can prevent XSS attacks if they are executed by exploiting vulnerabilities on systems that are not their own. Champion solutions this by breaking this problem apart into smaller steps, which we then fully remediate.
We begin by determining which of the two XSS attack vectors a retailer will be most prone to. These are either:
- Reflective XSS, which utilizes a particular page to run malicious code but requires a specifically designed URL to execute. This vector is not very common as it requires a complex level of social engineering to be effective.
- Stored XSS, which is when malicious code is stored on a local client and used to mine data submitted to a website (logon credentials or payment information). This is the most common vector used.
Once we determine this, things get a little trickier. Since the solution ultimately depends on the programming, plugins and interfaces a retailer uses on their web servers, next steps are always determined on a case-by-case basis. But, here are some of the more common fixes we have encountered in our retail engagements:
- Prevent HTML markup characters
- Use and optimize HTMLPurifier
- Avoid allowing raw HTML and opt for other markup options such as Markdown
- Invoke case sensitive template libraries
- Take advantage of the enhanced security features in modern web browsers, such as HTTPS-Only Cookies and Context-Security-Policy headers
While these are only a few of the techniques that can be used to head off XSS attacks, the proven effectiveness of these measures can go a long way towards protecting retail customer data.
Your XSS Champions
Champion has a great deal of experience working with retailers to harden their websites against social media-based web API vulnerabilities. Our technical staff is at the ready to engage with your business to lock the doors against XSS attacks, further protecting your customers in a hostile web environment. Reach out to us to start protecting your social media interests today.