Thursday, 18 June 2015

Bypass ".docx" Password Protection

If you're just here for the how to, skip down to the pictures after the break.

Now I know that bypassing passwords is something that not everyone likes to do. However sometimes you can forget the password for a critical file or someone has sent you a file and forgotten to tell you the password to edit it.

Microsoft office's new (can I still call it that) xml based document formats have capacity for accidental write protection. Some of these include password protection. While this is great, particularly if sending spreadsheets to a customer; it isn't so great when HR send a file that needs to be edited and even they can't remember the password. That was the problem and thanks to Horatio and this Superuser answer. I was able to save the day and remove the password protection.
This may or may not work for everything but I hope it helps you out. It goes without saying that any damage or liability is taken by you if you choose to follow these instructions.

  1. Firstly I will create a password protected .docx file:

    In the review tab of Microsoft Word select protect document.Work through the options for the settings you desire. Then save, this will give you a password protected Word Document.
  2. Now we need to get access to the .xml files that make up the .docx

    The easiest way to do this is to just rename the file and change the file extension to .zip
  3. Next we need to open the settings xml

    To do this we extract the .zip file and open the folder called "word" in the root of the zip.
  4. We are getting close now, this is the interesting part. We open the file called settings.xml

    This is the part we are interested in. I have only opened it in Internet Explorer because it is the default viewer. From here on the file must be edited. The default editor is notepad which is plenty sufficient for this.
  5. This is more or less what the interesting part should look like to start with.

    We need to change this part of it: enforcement="1"
    To: enforcement="0"
  6. Once this is done we can save and close everything back up.

  7. Then we re-zip the files

    Rename the .zip back to a .docx
Now you are finished. Enjoy a cold beverage and rest easy, knowing how simple it is to recover your documents from a password protection.