What happened
Replaying the Twilio July 2020 intrusion
- 1
Configured: an open write path
About five months after the path was added in 2015; date not statedA bucket policy statement grants anyone on the internet read and write access to the taskrouter path of media.twiliocdn.com.
- 2
Overwritten through the open path
Jul 19, 2020, 20:12 UTCSomeone using the Tor network uploads a modified TaskRouter JS SDK v1.20 to the writable path.
- 3
Served to browsers
Jul 19, 2020, 20:12 UTC, to Jul 21, 2020, 05:30 UTCPages that load v1.20 deliver the modified SDK to their visitors' browsers, where it calls a redirector and loads a script aimed at mobile users.
- 4
Found and closed
Jul 20, 2020, from 04:20 UTC; audit date not statedAn alert leads Twilio to replace the file and lock down the bucket, and an audit finds other buckets with improper write settings.
A modified TaskRouter JS SDK v1.20 was served through CloudFlare's CDN and directly from the bucket until Twilio replaced it, and may have stayed in caches for up to 24 hours more. In browsers it loaded a redirector that Twilio associates with Magecart and relates to a malvertising campaign aimed at mobile users. Twilio has no evidence that customer data was accessed and cannot tell what impact any user experienced; how many browsers loaded the file is unknown.
Where cloud-provider controls fit
The step that decided this incident was a bucket policy that let anyone write. Amazon S3 Block Public Access refuses such a policy when it is saved, and with RestrictPublicBuckets it also refuses a write from outside the bucket owner's account under a policy that already stands; a service control policy keeps the setting from being switched off during troubleshooting. Both refuse the public read too, so they fit when your CDN reads the bucket as a named principal. A resource control policy bounds who can write to the buckets in your organization's member accounts, whatever a bucket policy grants. Once a changed file is served, no cloud-provider control reaches it: a Subresource Integrity hash and a Content Security Policy on your pages own that step.
Could this have been prevented?
In hindsight, not as a whole. 2 controls would have refused a step outright, and 4 controls would have limited one. 3 steps have no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.
- 2
- Prevented
- 4
- Contained
- 3
- Not covered
How it could have been prevented
The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.
Replaying the Twilio July 2020 intrusion
1 · Configured: an open write path
1 Prevented1 Contained4 on other clouds2 · Overwritten through the open path
1 Prevented1 Contained4 on other clouds3 · Served to browsers
2 Not covered4 · Found and closed
2 Contained1 Not covered3 on other cloudsKey facts
- The AllowPublicRead bucket policy statement granted "AWS": "*" s3:GetObject and s3:PutObject on the taskrouter/* path of media.twiliocdn.com; Twilio added the write access while troubleshooting a build system and did not reset it
- On July 19, 2020 at 20:12 UTC someone using the Tor network uploaded a modified taskrouter.min.js, TaskRouter JS SDK v1.20; the Chat, Video and Client SDKs on the same domain were not modified
- The modified code set a cookie named jqueryapi1oad and loaded a URL that Twilio associates with Magecart; Twilio believes it was built to serve malicious advertising to mobile users
- Twilio received an alert at about 04:20 UTC on July 20 and, about one hour later, replaced the file and locked down the bucket's permissions; the file may have stayed in CDN or browser caches for up to 24 hours more
- Twilio told Help Net Security the malicious version was served "for 8 or so hours"; an anonymous source told The Register about 10 hours
- Twilio reported no evidence that customer data was accessed; its audit found other buckets with improper write settings, one a backup of the original bucket, and gave no count
Sources
Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.
- 1.Incident Report: TaskRouter JS SDK Security Incident - July 19, 2020Twilio · Jul 22, 2020 · Vendor reporttimeline, bucket policy, origin of the write access, upload via Tor, injected code, Magecart association, impact, other buckets, remediation, follow-up commitments, customer actions
- 2.Twilio: Someone waltzed into our unsecured AWS S3 silo, added dodgy code to our JavaScript SDK for customersThe Register · Jul 22, 2020 · Newsfirst disclosure, Twilio's first statement, exposure duration, RiskIQ observation
- 3.Attackers exploit Twilio's misconfigured cloud storage, inject malicious code into SDKHelp Net Security · Jul 23, 2020 · Newsexposure duration, other SDKs on the bucket, RiskIQ comment, impact caveat
- 4.More S3 Buckets Compromised with Magecart and Malicious RedirectorInfosecurity Magazine · Jun 9, 2020 · Newsjqueryapi1oad redirector, Hookads malvertising, campaign dates and counts, misconfigured S3 buckets as the vector
- 5.When did you last check your AWS S3 security? Here's four scary words: 17k Magecart infectionsThe Register · Jul 12, 2019 · NewsS3 campaign method, scale, start date, skimmer payload, recommendations
- 6.Amazon S3 Block Public Access – Another Layer of Protection for Your Accounts and BucketsAmazon Web Services, AWS News Blog · Apr 27, 2023 · AdvisoryS3 Block Public Access settings, account and bucket scope, launch date, defaults
The estate in the replay is illustrative and drawn at the level of attack stages; the victim's real environment is not public. Verdicts describe what a control does when it is in place before the incident. They are not an assessment of the victim's security program.