Question Locked

Kill Switch a file on windows

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Hypothetically would it be possible to make it that if a password was incorrectly entered x amount of times on a password protected file the file would be deleted permanently.

11 replies

by rproffitt edited

But this is not a feature on Windows, Apple OS or Linux so you'll have to wrap the document inside some app.

by sender282

Where could I find further information on this or what would I look up for further research for security measures such as this

by kees_b edited

The maker of the program that asks for the password to protect the file. For example, a zip-file can be password protected. Then ask the author of the program you want to open it with (like 7-zip) to implement such a feature.
But, of course, any copy of that file the user made wouldn't be deleted, although still inaccessable without the password. I see no added security by deleting the original if the user can make as many copies of the file as he wants.

By the way, 7-zip is open-source. So you can build your own version that has this.

it might be easier to publish such an encrypted file on your website, and asking for a password to download it. Then only people with the password can download and read it. That's a nice protection. Maybe there is no reason even to encrypt it.

by sender282

If you were to do it through the opening application like 7zip could someone use a different program like winrar to try unlock it and bypass the file delete script? Would there be a way to embed the script into the file itself?

by kees_b

First question: yes.
Second question: no. A file that is being accessed, can't be deleted, so a file can't delete itself.

All you can do:
1. Send an encrypted file.
2. Send a program that asks for a password to open it, and deletes it when the password is entered wrong x amount of times. When it's entered correctly, it should decrypt the file to a temporary unencrypted one and open that with the right program (like MS Word if it's a word document, or Adobe Reader if it's a pdf-file), Most of such programs allow the use to save the (unencrypted) file. That's not a very good security, isn't it? And, of course, the user can make any number of copies of the original unencrypted version.

I don't think it's a feasible idea.

by rproffitt edited

Example of how to delete that app that would have created the document.

1. Password, etc.
2. On failure, create another app, launch that app, first app exits and the second app deletes the first executable.

Let's be honest here. If you can't write code, you should outsource this.

by kees_b

That leaves you with a useless backup copy of the first program and the second program in a temp folder. A zip-file with a password seems a better idea to me.

by sender282

I really appreciate the responses. And I apologise for so many follow up questions. Would there be another angle I could approach it from like maybe keeping the file on a usb drive and put a protocol in place that the drive would wipe if incorrectly accessed

by kees_b

No, you can't wipe a file system that has a file that's being accessed.

Why do you want this so badly?

by DediRock

Yes, it's technically possible with a custom script, but risky—accidental deletions could be a nightmare. Use with extreme caution.

by piperrebecca977

Yeah, hypothetically it’s possible. You could write a script or use a program that tracks failed attempts and deletes the file after a set number. But there are a few catches:

It’s risky — accidental typos or bugs could wipe your file.

File deletion isn’t always truly permanent unless you overwrite it securely.

Most mainstream encryption tools (like VeraCrypt or BitLocker) don’t have this feature built-in because it can lead to data loss.

You’d need custom code or a modified tool to do it safely and reliably. It’s more of a niche security measure than a standard practice.

This discussion is closed to new replies.