Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Excel's worksheet password protection work

This code has been floating around the net for quite a few years - it's apparently able to provide a password for decrypting an excel spreadsheet that you don't know the password to.

http://www.theofficeexperts.com/VBASamples/Excel02.htm

I'm interested in how this works but I don't seem to be able to work it out. I'm assuming it's encrypted under a certain value that can be gotten to in a number of ways (a few places on the net say it'll give you the original password or another one that will work) sort of like a public key - you can have 100 public keys that all work with a single private one.

To me it seems like it's creating integer variables and filling them with a specific number, before turning that number into the relevant characters. Wouldn't these always be the same? If so, is there "master password" for Excel protection?

Thanks all!

EDIT: I've noticed the For n = 32 To 126 in the example code I posted. Cross referencing with an ASCII table that seems to be all characters from space through to tilde. Is this some sort of dictionary attack I'm not understanding due to syntax?

like image 248
Andrew White Avatar asked Oct 12 '12 04:10

Andrew White


1 Answers

It is a small world, as the code indicates I posted that code at another forum around 10 years ago having seen it somewhere else - I think on John Walkenbach's old web site

It is important to note that this code protection applies to worksheet protection only - not to Excel's file open or VBA passwords.

  • One example of this write-up in full is here (screenshot below)
  • googling excel sheet protection “test” and “zzyw” gives other references such as this from Tom Urtis

enter image description here

like image 83
brettdj Avatar answered Sep 29 '22 23:09

brettdj