Are your security tokens truly secure?
Explore how Reflectiz helped a giant retailer to expose a Facebook pixel that was covertly tracking sensitive CSRF tokens due to human error misconfigurations. Learn about the detection process, response strategies, and steps taken to mitigate this critical issue. Download the full case study here.
By implementing Reflectiz’s recommendations, the retailer avoided the following:
- Potential GDPR fines (up to €20M or 4% of turnover)
- $3.9M data breach cost [on average]
- 5% customer churn
Introduction
You might not know much about CSRF tokens, but as an online retailer, you need to know enough to avoid any accidental oversharing of them by the Facebook Pixel. Getting this wrong could mean enormous fines from data protection regulators, so the purpose of this article is to give you a brief overview of the problem and explain the best way to protect your business against it.
You can explore this key issue in greater depth by downloading our free new case study on the subject [from here]. It goes through a real-world example of when this happened to a global online apparel and lifestyle retailer. It explains the issue they faced in more detail, but this article is a bite-sized overview of the threat to get you up to speed.
Let’s take a deeper look at how this issue unfolded and why it matters for online security.
What happened and why it matters
In a nutshell, a web threat monitoring solution called Reflectiz discovered a data leak in the retailer’s systems that others didn’t: its Facebook Pixel was oversharing a security technology called CSRF tokens that it should’ve kept under wraps.
CSRF tokens were invented to stop CSRF, which stands for cross-site request forgery. It’s a type of cyberattack that involves tricking a web application into performing certain actions by convincing it that they came from an authenticated user.
Essentially, it exploits the trust that the web application has in the user’s browser.
Here’s how it works:
- The victim is logged into a trusted website (for instance, their online banking).
- The attacker creates a malicious link or script and tricks the victim into clicking it (this could happen via email, social media, or another website).
- The malicious link sends a request to the trusted website. Since the victim is already authenticated, their browser automatically includes their session cookies or credentials, making the request appear legitimate to the web application.
- As a result, the web application will carry out the action in the attacker’s malicious request, such as transferring funds or changing account details, without the victim’s consent.

[Note that this is not a malicious activity event. All ‘blockers’ that monitor the traffic for malicious scripts would not detect any issues.]
Developers can use various tools to stop this happening, and one of them is CSRF tokens. They ensure that authenticated users only perform the actions they intend to, not the ones requested by attackers.
Reflectiz recommended storing CSRF tokens in HttpOnly cookies, which prevents third-party scripts, like Facebook Pixel, from accessing them.
The misconfiguration problem
In the case study example [that you can find here] the retailer’s Facebook Pixel had been accidentally misconfigured. The misconfiguration allowed the pixel to inadvertently access CSRF tokens—critical security elements that prevent unauthorized actions on behalf of authenticated users. These tokens were exposed, creating a serious security vulnerability. This breach risked multiple security issues, including potential data leaks and unauthorized actions on behalf of users.
Like many online retailers, your website will probably use the Facebook Pixel to track visitor activities to optimize its Facebook advertising, but it should only be gathering and sharing the information it requires for that purpose, and it should only be doing so after obtaining the correct user permissions. Since CSRF tokens should never be shared with any third party, that’s impossible!
Here’s how Reflectiz’s technology works to uncover such vulnerabilities before they turn into serious security risks.
The Fix
Reflectiz’s automated security platform was employed to monitor the retailer’s web environment. During a routine scan, Reflectiz identified an anomaly with the Facebook Pixel. It was found to be interacting with the page incorrectly, accessing CSRF tokens and other sensitive data. Through continuous monitoring and deep behavioral analysis, Reflectiz detected this unauthorized data transmission within hours of the breach. This was a bit like sharing the keys to their house or the password to their bank account. They’re actions that others could exploit in the future.

Reflectiz acted swiftly, providing a detailed report to the retailer. The report outlined the misconfiguration and recommended immediate actions, such as configuration changes to Facebook Pixel code, to stop the Pixel from accessing sensitive data.

Data protection regulators take a dim view of your business even if it accidentally overshares this kind of restricted information with unauthorized third parties, and fines can easily run into millions of dollars. That’s why the 10 to 11 minutes it will take you to read the full case study could be the best time investment you make all year.
Next Steps
Reflectiz’s recommendations didn’t just stop with immediate fixes; they laid the foundation for ongoing security improvements and long-term protection. Here’s how you can protect your business from similar risks:
- Regular Security Audits:
- Continuous Monitoring: Implement a system of continuous monitoring to track all third-party scripts and their behavior on your website. This will help you detect potential vulnerabilities and misconfigurations in real-time, preventing security risks before they escalate.
- Periodic Security Audits: Schedule regular audits to ensure that all security measures are up to date. This includes checking for vulnerabilities in your third-party integrations and ensuring compliance with the latest security standards and best practices.
- Third-Party Script Management:
- Evaluate and Control Third-Party Scripts: Review all third-party scripts on your website, such as tracking pixels and analytics tools. Limit the access these scripts have to sensitive data and ensure they only receive the data necessary for their function.
- Use Trusted Partners: Only work with third-party vendors that meet stringent security and privacy standards. Ensure that their security practices align with your business’s needs to prevent unauthorized data sharing.
- CSRF Token Protection:
- HttpOnly Cookies: Follow Reflectiz’s recommendation to store CSRF tokens in HttpOnly cookies, which prevents JavaScript (including third-party scripts) from accessing them. This is a key measure in protecting tokens from unauthorized access by third-party vendors.
- Enforce Secure Cookie Attributes: Ensure that all CSRF tokens are stored with Secure and SameSite=Strict attributes to protect them from being sent in cross-origin requests and mitigate the risk of exposure through malicious third-party scripts.
- Privacy by Design:
- Integrate Privacy into Your Development Process: As part of your development and deployment processes, adopt a Privacy by Design approach. Ensure that privacy considerations are at the forefront, from the way data is stored to the way third-party scripts interact with your site.
- User Consent Management: Regularly update your data collection practices, ensuring users have control over what data they share. Always obtain clear, informed consent before sharing any sensitive data with third parties.
- Educate Your Team:
- Security Training: Make sure your development and security teams are well-trained in the latest security protocols, especially related to data privacy and CSRF protection. Awareness and understanding of security risks are the first steps to preventing issues like this.
- Cross-Department Collaboration: Ensure that marketing and security teams are aligned, especially when using third-party tools like the Facebook Pixel. Both teams should work together to ensure that security and privacy concerns are considered when implementing such tools.
- Adopt a Zero-Trust Approach:
- Zero-Trust Security Model: Consider adopting a Zero-Trust approach to security. This model assumes that all users, both inside and outside the network, are untrusted and verifies each request before granting access. By applying this philosophy to data exchanges between your site and third-party services, you can minimize exposure to risks.
By implementing these next steps, you can proactively strengthen your security posture, safeguard your sensitive data, and prevent similar issues in the future. Reflectiz’s insights provide the roadmap to build a more resilient and secure web environment. Protecting your business from emerging threats is an ongoing effort, but with the right processes and tools in place, you can ensure that your systems remain secure and compliant.
Download the full case study here.