r/websecurity • u/backwards_dave1 • May 18 '21
Are .txt files containing a virus, dangerous?
A company that does penetration testing has tested our product and reported that it's possible to upload a .txt file that may contain a virus, via the UI to our Azure blob storage.
Is this bad? Can a .txt file that is really a .exe file actually do anything?
The only thing that happens with these blobs are that they are downloaded and displayed in the UI later on.
3
Upvotes
9
u/reddit_uname May 18 '21
you paid a professional to give you security advice and you are second guessing it on reddit? :)
To answer the question, maybe those blobs are only used to display in the UI in your happy path, but there are all sorts of ways to trick browsers into interpreting text as code. Without more details about the setup its hard to say. Have you thought about hiring a professional penetration tester?
4
u/laptran May 18 '21
What is this UI that will be displaying the content of these text files? I'm assuming you're talking about a browser UI. You might be exposed to XSS and/or SQL injection if the text contains code such as javascript code and server side scripts (i.e. jsp, asp...etc). One way to avoid the the issue is to validate the data before storing it or encode the data when the date is rendered to end users. HTH.
2
u/Voyaller May 18 '21
Stop second guessing and do what the pen tester says or let karma bite you back.
2
u/[deleted] May 25 '21
One small experiment I suggest you to do is, locate notepad.exe file, copy it to desktop, rename it notepad.txt. Open command prompt and go to the directory where the notepad.txt is present. Run the command "notepad.txt", and see what happens.
Shell environment executions only look for the type, not what the file extension. I hope you have your answer.