Unprotecting Microsoft Word .docx document

Let’s say that you get a form, for example from the government, in Microsoft Word format. You need to fill in the fields which are supposed to be nicely laid out for you. However there are problems filling in those fields because of document formatting, Microsoft Word version incompatibility, etc. argh reasons. This wouldn’t happen in the beatiful word of Office productivity suite, would it?

You could easily fill in the form if you could simply just edit the document and put the text there. But this is prevented using Microsoft Word form password protection mechanism. You need to know the password to enable the editing of the document.

The documention “protection” is not actually very big protection at all. You simply have a flag in the .docx file telling “oh please dear user do not change my beautiful document and just try to have your text in the predefined fields”. The authors of the document are probably right and an average Joe will destroy the document formatting in Word. On the other hand if you know what you are doing you just can get your paperwork done. The password, saved inside the document, is not very much protection, as you can manually gut the document and flip the flag inside.

.docx is actually zip archive containing XML files and you can manipulate its contents with a text editor and ZIP program. Unzip:

mkdir temp
cd temp
unzip ../"KEHITTÄMISTUEN MAKSATUSHAKEMUS.docx"

Edit the unzipped file word/settings.xml using your favorite plain-text editor.

Remove attributes in the following element:

<w:documentProtection w:edit="forms" w:enforcement="1" 
  w:cryptProviderType="rsaFull" 
  w:cryptAlgorithmClass="hash" 
  w:cryptAlgorithmType="typeAny" 
  w:cryptAlgorithmSid="4" 
  w:cryptSpinCount="50000" 
  w:hash="iMNelgcwaqcjZrxjRjtl0SRWLpY=" 
  w:salt="ik/s9VEtUXAkIehywGuyqQ=="/>

Now it looks like:

<w:documentProtection />

Re-zip:

zip -ur ../KEHITTÄMISTUEN\ MAKSATUSHAKEMUS.docx *

Re-open in Microsoft Word.

Poof. The form protection is gone. Sip coffee and continue with your inspirating paper work.

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

29 thoughts on “Unprotecting Microsoft Word .docx document

  1. please explain me more about all of itbecause I’m not familiar enough with computer programs. thank you

  2. Trying to open a dreaded .docx file with an ‘open’ password. I saved it as a .zip file, unzipped, and then all i got was the .docx file again. Tried to view in NotePad+, but did not see anything resembling ‘document protection’ or settings. All I saw was some coding about encryption. Help!

  3. Génial, ça marche !
    I first got a message from Word2010 telling me that there is an error in the document and it cannot be opened. Then it proposed to try to recover the content and as you said “poof” my document is fully retrieved, without any protection.
    Thanks again for this excellent tip.
    FredP

  4. [6]DataSpaces , EncryptedPackage,EncryptionInfo,WordDocument, FIRST ONE IS FOLDER AND OTHERS ARE FILES, I EXTRACT BUT ABOVE FILES I GOT, THERE IS NOTHING LIKE XML AFTER EXTRACTED. ANY IDEA ? DOCX IS PASSWORD PROTECTED. I ALSO TRIED TO OPEN ABOVE FILE BUT ITS ALL ENCRYPTED…

  5. This method only works for documents that can’t be EDITED without the password. Documents that require a password are effectively encrypted, so you’ll need the password to decrypt it. No readable XML files there because they are encrypted.

  6. Work perfectly, right click .docx file, open with, select win-rar, then click the word folder, double click settings.xml, opens in dreamweaver, remove the code, hit save, winrar prompts you to update the archive, hit yes, open the file again, voila!

    NICE WORK!@#!!@# :))))

  7. Work perfectly, right click .docx file, open with, select win-rar, then click the word folder, double click settings.xml, opens in dreamweaver, remove the code, hit save, winrar prompts you to update the archive, hit yes, open the file again, voila!

    NICE WORK!@#!!@# :)))))))

  8. Hi guys,

    Can anyone please let me know how to do this in the simplest of terms, Have tried to follow the prompts in the comments but dont have such an in depth knowledge of computers. Urgently need to open this document.

    Thanks in advance,

  9. Hi Mikko,

    If I send you a copy of the file I’ve lost my password for, can you help me open it?
    It is a Microsoft Word .docx, locked with a password, which I’ve forgotten. I think I set it to ‘strong’ encryption.

    Thanks – J.N.

  10. This blog post is self-service instructions for the people having enough expertise in the area.

    If you are looking for a help or do not understand the instructions I suggest looking for professional help, as I do not have time or motivation to be interested in lost password problems.

  11. I unzip file docx and can’t see anything look like setting.xml….and I only see the three following files [6]DataSpaces, EncryptionInfo, EncryptedPackage…Please Help me !!!
    P/s I used Word 2010

  12. I am looking at purchasing an decryption software, for docx, word 2013. Which software is trhe best decryption software out there? Anyone know?

  13. i tried to extract the file, but it shows the error “damaged file or corrupted archive”….help me with this plssssss

  14. This method only works for documents that can’t be EDITED without the password. I need the open password of the file creates in Word 2010.
    With this method you can’t open the zip file, because the program ask for you the password again.
    Anybody can help me? maybe with HEX method?
    Thank you so much.

  15. No need to remove all attributes from the line. Just replace w:enforcement=”1″ with w:enforcement=”0″

  16. Excerrent trick, thanks bukko!

    For those that want a different route, simply rename the file as a .zip, open the folder, open the folder named “word”, then delete the settings.xml file. Now rename the entire file as a .docx and enjoy.

    Followup Q: I tried to get sneaky and replace the original pw after making my edits. I made a copy of the original doc and then attempted to replace the new settings.xml file with the old one, but doesn’t look like this is possible. Know an easy trick to this?

    Cheers

  17. I did this without zip and unzip. I am using Office 2007. Right click the file1.dotx and click “Open With” and click “Microsoft Office Word”. Once the file opens, Click “File, “Save as” and “Word Document”. Windows explorer will open to select where you want to save. Select you current folder. Change the file format, click “Save as type” down arrow and select “Work XML Document”. Right click on the new file file1.xml and click “Open with” and select “Note Pad”. Click “Edit”, then “Find” and then enter w:enforcement=”1″ in the dialog box. Click “Find Next”. If the document was locked, you should fine this phrase. Once located, change the “1” to “0”. Change only that character. Save and close the file. Right click on the updated file1.xml and select “Open With” Microsoft Word. The file will open with full access. Click File, Save As ,Word Document and Close. You document is unlocked.

  18. Your a star this worked perfectly, who knew a DOCX was just really a ZIP? I assume this works for all the latest Office programs as long as the file ends X?

    I used 7zip to do the zipping myself, just right click the DOCX and extract to folder, then edit the XML then go up a level and select all the folders and files and used 7zip to send to a zip file then just renamed to DOCX.

    Thanks

  19. I’ve tried several times and got the same problem: the document can’t be opened due to problmes with the content, I choose the option of recovery but still doesn’t work :’-(

  20. I am having problems opening files password protected files ending enx or xenx i.e. word, excel etc. I had a burglary and my laptop was stolen amongst other things, but I had kept a back up of most of my files on an external hard drive. Now that I need to update some of those files I am unable to open them, because I am using office and windows 10. I am not computer savvy, so will need help and advice.

  21. Your solution was close to perfect. Improvement:
    – Just save the word doc as xml file
    – Open xml file in and edit code as described, and save
    – Just open xml file in word

    Ie. no need to zip/unzip, at least in Word 2010.

Leave a Reply

Your email address will not be published. Required fields are marked *