2 click Remote Code execution in Evernote Android
The Evernote Android app failed to sanitise attachment filenames received from the content-disposition header, allowing path traversal. An attacker could rename an attachment to a path like '../../../lib-1/libjnigraphics.so' and, when the victim clicked the attachment, write a native library into the app's lib directory, leading to remote code execution.
Originally disclosed on HackerOne
- Triaged in 8 days
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 5 months
This vulnerability is similar to my previous reported vulnerability #1362313 , in here also weakness is path transversal vulnerability which helps me to acheive code execution but the root cause is different.
some part of this app is written in java and some parts are written in react native.
In evernote we can share notes and notebooks with others. In notes we can also add attachments and there is option to rename the added attachment. When renaming i founded that special characters are not restricted,for example file uploaded with name libjnigraphics.so can be renamed to ../../../lib-1/libjnigraphics.so and when the attachment is downloaded it is downloaded with filename ../../../lib-1/libjnigraphics.so.
The evernote android app also does not sanitize the received filename, so when user clicks on attachment,instead of attachment getting downloaded in /data/data/com.evernote/cache/preview/:UUID/ this directory it is downloaded into /data/data/com.evernote/lib-1/libjnigraphics.so which results into remote code execution.
#1362313 report vulnerability root cause was that the app was not sanatizing the value of
_display_namefrom the provider of receivedcontent://uri that resulted into ACE.
This report's root cause is that app is extracting attachment filename from
content-dispositionheader eg:-content-disposition: attachment; filename="../../../lib-1/libjnigraphics.so"and the evernote app is not sanatizing the received filename from the response header. The attachment download logic is written in react-native and the source file is compiled into hermes javascript bytecode, so i am not able to show the exact vulnerable code like i did in my last report.
The conclusion i reached was that fixing this report #1362313 bug will not fix this vulnerability so i am writing a new report.
Steps To Reproduce:
[add details for how we can reproduce the issue]
- Add the native-library poc file to a note (Attachment on the original report: libjnigraphics.so)
- Rename the attachment to
../../../lib-1/libjnigraphics. - Invite the victim to your note.
Step 2 is needed,i don't know why Shareable link feature is not working on evernote android app without sending an invitation
3. Click on 3 dots > copy internal link > copy web link OR copy app link(which is android deeplink and can be triggred from websites)
4. Send link to victim and open the link (1st click)
5. Click on attachment when note is opened (2nd click)
6. Close the evernote app and open it again.
From adb shell run nc 127.0.0.1 6666
- use physical device because i have provided the arm64 architecture native library
POC VIDEO
Impact
remote code execution in evernote android app with 2 clicks.
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
The app extracted the attachment filename from the content-disposition header and did not sanitise it, allowing path traversal.
Impact
Remote code execution in the Evernote Android app with two clicks.
What the attacker needed
Evernote Android app; Attacker can share a note with the victim; Victim clicks a link and then the attachment
How it was found
- Add a native-library proof-of-concept file to a note.
- Rename the attachment to a path traversal name.
- Invite the victim to the note.
- Copy the internal link (web or app link) and send it to the victim.
- Victim opens the link (first click).
- Victim clicks the attachment (second click), then closes and reopens the app.
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.
When you download a file, the server can suggest a filename. If the app trusts that name without cleaning it, an attacker can use '../' to make the file save outside the intended folder. Here, the app saved a malicious library file into a place where the system loads code, so the attacker could run their own code on the phone.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.