55

I have a Microsoft .docx document that is locked down and can't even be viewed without the forgotten password.

I'm wondering if there is an easy way to unlock it or get the computer to remember the password itself with a hint or something.

5 Answers 5

72

DocX is a compressed zip container file. Make a copy of the original docx file. If you unzip it, there is a subfolder named word with a file named settings.xml. You can open settings.xml with a plain text editor.

Within that there is a block of text:

<w:documentProtection
w:edit=""
w:enforcement="1"
 w:cryptProviderType=""
 w:cryptAlgorithmClass=""
 w:cryptAlgorithmType=""
 w:cryptAlgorithmSid=""
 w:cryptSpinCount=""
 w:hash=""
 w:salt=""/>

You can either change w:enforcement value to 0 or remove the block entirely.

Then you zip up the whole thing again (don't zip up the whole folder: the content_types.xml and subfolders must be root of the zip file.), rename the result to have a Docx extension, and then open it in word.

4
  • 7
    In Word 2010, this works only if the document is not read-protected, so it won't work for the OP. If the 2010 document is read-protected, it does not appear as a valid ZIP file. Also, the 2010 tag name is writeProtection rather than documentProtection and there is no w:enforcement.
    – Ben
    Jan 9, 2015 at 21:01
  • 1
    It's honestly sad it's that easy to "unencrypt" a shipping product...
    – MarcusJ
    Jun 25, 2015 at 23:41
  • 1
    I honestly can't believe a security company just sent me a doc with this type of protection
    – vault
    Dec 21, 2016 at 11:29
  • 8
    To clarify, this method is for making a document editable again. It will not allow you to view a password‑encrypted document.
    – Zenadix
    May 3, 2018 at 4:48
13

From this link: http://people.csail.mit.edu/seth/misc/unlockworddoc.html

How to Unlock a Word Document under Windows

Seth Teller, August 2009

Some authors (for example, of forms to be filled out) "lock" their documents under Windows. This is annoying, as it prevents you from fixing errors or adding anything to the document.

If you web-search on "unlocking word document," you get a bunch of pages with advice that doesn't work under Windows, or pointers to paid software. Here is a method that works, and is free:

  1. Open your document in Word, then save it in ".xml" format.

  2. Open the .xml doc in wordpad, emacs, or your favorite text editor.

  3. Search for the string w:enforcement="1".

  4. Replace the "1" with a "0" to disable enforcement (i.e., unlock the document).

  5. Save the document from your text editor.

  6. Open the .xml document in Word.

  7. Choose "Save as..." and save it as a .doc or .docx file.

Your Word document can now be edited normally. Enjoy!

Mac users: ExtendScript Toolkit works well as a text editor in this workaround.

3
  • 2
    "Open your document in Word, then save it in ".xml" format." cant open document... we are precisely looking for the pass for do that...
    – Matrix
    Aug 16, 2017 at 11:05
  • 4
    This technique is for removing the readonly flag, not the document password..
    – stuartd
    Aug 16, 2017 at 11:12
  • This also appears to work for removing the ability to disable tack changes
    – Jeef
    Nov 27, 2017 at 12:22
11

MS Word has used 128-bit AES encryption since Office 2007 so no, there's no easy way to unlock it.

If you think your password is simple enough or vulnerable to a dictionary attack, you could try one of the various password cracking apps available (caveat downloader).

It's trivial to remove the Edit protection from Word documents by editing settings.xml within the compressed .docx file as discussed in other answers here. However, as you have applied Encrypt with Password to require a password to open the document, that method won't be available.

3

If your document, renamed to .zip, has no settings.xml file in it but contains a file called EncryptionInfo instead, there's a good chance that strong encryption was used with a more modern version of Office.

Your only chance is really to brute-force decrypt it, for which there are guides.

Broadly speaking:

  1. you will need to extract the password hash, for that you can use office2hashcat.py from https://github.com/stricture/hashstack-server-plugin-hashcat/blob/master/scrapers/office2hashcat.py (This tool hasn't been updated and works with an older version of Python, try version 3.0: https://www.python.org/downloads/release/python-301/)
  2. run office2hashcat.py document.docx > hash.txt
  3. Once you have hash.txt, use hashcat and a wordlist to brute-force the password. Having a fast GPU helps.

The full instructions can be found here:

https://tinyapps.org/docs/hashcat.html

2

Which OS and version of Word? If messing about with XMLs and text editors is not your cup of tea, in Word 2010 for Windows at least you can remove all restrictions, passwords, final locks etc. from File / Info / Permissions:

Word 2010 Doc Locks

Also make sure the file is not set to Read-only (close Word, right-click the file, check Properties / General tab / Attributes).

1
  • Will only work for 'Edit protection' not 'Open protection' as in the OP's case
    – pelms
    Sep 7, 2015 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .