[GH-ISSUE #2607] MS Money format strips 8th bit #1701

Closed
opened 2026-10-15 04:22:50 +07:00 by bsakaguchi · 10 comments
Owner

Originally created by @magnumripper on GitHub (Jul 3, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2607

Originally assigned to: @magnumripper on GitHub.

	// {"$money$1*103c3428c8f4e440*5aa4a678", "Müller"}, // Not yet working, Jackcess does not work either!
	{"$money$1*103c3428c8f4e440*5aa4a678", "M|ller"}, // Same hash but this password is cracked and accepted in MS Money Plus just fine!
	{"$money$1*d68792c7c8f4e440*e1c294bf", "|"}, // Original password is "ü", "|" works fine in official software!
	{"$money$1*353dc5f8c8f4e440*fb840c22", "D"}, // Original password is "ä"
	{"$money$1*e5eee9fec8f4e440*8f7777c9", "V"}, // Original password is "ö"
	{"$money$1*8c83d504c9f4e440*1a1108fa", "#"}, // Original password is "£"

From https://github.com/magnumripper/JohnTheRipper/pull/2603#discussion_r125364916 :

Letter hex (CP1252) relation
Ä 0xc4
D 0x44 0xc4 & 0x7f == 0x44
Ü 0xdc
| 0x7c 0xdc & 0x7f == 0x7c
Ö 0xd6
V 0x56 0xd6 & 0x7f == 0x56
£ 0xa3
# 0x23 0xa3 & 0x7f == 0x23

So what it does is use an "ANSI" code page, convert to upper and then strip 8th bit. We need to do so too, and I think that means we should set FMT_UTF8 but not FMT_8_BIT and also emit a warning if target encoding is UTF-8. I'll verify that and take care of this within the next days.

Originally created by @magnumripper on GitHub (Jul 3, 2017). Original GitHub issue: https://github.com/openwall/john/issues/2607 Originally assigned to: @magnumripper on GitHub. ```c // {"$money$1*103c3428c8f4e440*5aa4a678", "Müller"}, // Not yet working, Jackcess does not work either! {"$money$1*103c3428c8f4e440*5aa4a678", "M|ller"}, // Same hash but this password is cracked and accepted in MS Money Plus just fine! {"$money$1*d68792c7c8f4e440*e1c294bf", "|"}, // Original password is "ü", "|" works fine in official software! {"$money$1*353dc5f8c8f4e440*fb840c22", "D"}, // Original password is "ä" {"$money$1*e5eee9fec8f4e440*8f7777c9", "V"}, // Original password is "ö" {"$money$1*8c83d504c9f4e440*1a1108fa", "#"}, // Original password is "£" ``` From https://github.com/magnumripper/JohnTheRipper/pull/2603#discussion_r125364916 : Letter | hex (CP1252) | relation ------ | ------------ | -------- Ä | 0xc4 D | 0x44 | 0xc4 & 0x7f == 0x44 Ü | 0xdc \| | 0x7c | 0xdc & 0x7f == 0x7c Ö | 0xd6 V | 0x56 | 0xd6 & 0x7f == 0x56 £ | 0xa3 \# | 0x23 | 0xa3 & 0x7f == 0x23 So what it does is use an "ANSI" code page, convert to upper and *then* strip 8th bit. We need to do so too, and I think that means we should set FMT_UTF8 but not FMT_8_BIT and also emit a warning if target encoding is UTF-8. I'll verify that and take care of this within the next days.
Author
Owner

@magnumripper commented on GitHub (Jul 5, 2017):

@kholia it occured to me we need just a little more data to be sure we do this right. It's most likely either of these ways:

  1. ANSI codepage -> strip 8th bit -> UCS-2
  2. ANSI codepage -> UCS-2 -> only use lower 7 bits

I'm assuming no. 1 but it could be no. 2 or something else. We need a test vector with some password that doesn't exist in CP1252, eg. "Я". Could you create that please? First, try creating such hash using your existing machine still using CP437/CP1252 and pasting the "Я" in the password dialog. Then reconfigure that OS to russian so it ends up using (I guess) CP866/CP1251 and re-create a hash again with same password verifying it's the same (if not, hand me both).

You don't need to find out what ASCII password/letter the hash(es) end up as after the 8th bit strip, I'll do that.

<!-- gh-comment-id:313045930 --> @magnumripper commented on GitHub (Jul 5, 2017): @kholia it occured to me we need just a little more data to be sure we do this right. It's most likely either of these ways: 1. ANSI codepage -> strip 8th bit -> UCS-2 2. ANSI codepage -> UCS-2 -> only use lower 7 bits I'm assuming no. 1 but it could be no. 2 or something else. We need a test vector with some password that doesn't exist in CP1252, eg. "Я". Could you create that please? First, try creating such hash using your existing machine still using CP437/CP1252 and pasting the "Я" in the password dialog. Then reconfigure that OS to russian so it ends up using (I guess) CP866/CP1251 and re-create a hash again with same password verifying it's the same (if not, hand me both). You don't need to find out what ASCII password/letter the hash(es) end up as after the 8th bit strip, I'll do that.
Author
Owner

@kholia commented on GitHub (Jul 5, 2017):

@magnumripper The plan sounds excellent! I don't know if regular Windows XP with English language can be simply configured to use Russian as the language. I will give it a try though.

<!-- gh-comment-id:313051728 --> @kholia commented on GitHub (Jul 5, 2017): @magnumripper The plan sounds excellent! I don't know if regular Windows XP with English language can be simply configured to use Russian as the language. I will give it a try though.
Author
Owner

@kholia commented on GitHub (Jul 5, 2017):

@magnumripper Here are the results,

$ cat hashes
ü-2004.mny:$money$0*50ed486c23f5e440*b1c6012d
Weird-R-russian-character-with-CP437.mny:$money$0*5b5e6ad223f5e440*944b1818
Weird-R-russian-character-with-russian-language.mny:$money$0*84e9ddc423f5e440*4687c834

JtR cracking session,

|                (ü-2004.mny)
?                (Weird-R-russian-character-with-CP437.mny)
_                (Weird-R-russian-character-with-russian-language.mny)

The last two files use "Я" as the password (copy-pasted from notepad).

Update: The password transformation seems to be dependent on the code page.

<!-- gh-comment-id:313060261 --> @kholia commented on GitHub (Jul 5, 2017): @magnumripper Here are the results, ``` $ cat hashes ü-2004.mny:$money$0*50ed486c23f5e440*b1c6012d Weird-R-russian-character-with-CP437.mny:$money$0*5b5e6ad223f5e440*944b1818 Weird-R-russian-character-with-russian-language.mny:$money$0*84e9ddc423f5e440*4687c834 ``` JtR cracking session, ``` | (ü-2004.mny) ? (Weird-R-russian-character-with-CP437.mny) _ (Weird-R-russian-character-with-russian-language.mny) ``` The last two files use "Я" as the password (copy-pasted from notepad). Update: The password transformation seems to be dependent on the code page.
Author
Owner

@kholia commented on GitHub (Jul 5, 2017):

I think I made a mistake in creating the third file above!

Here are two new hashes from files created with password "Я" with Russian as the language in Windows XP.

1.mny:$money$0*00b81d0326f5e440*407472c8
2.mny:$money$0*ec97d8f325f5e440*f1f8aa0c

They both yield "?" as the password which matches the Weird-R-russian-character-with-CP437.mny result above.

Update: I might still be doing something wrong. This stuff is very puzzling to me :-)

<!-- gh-comment-id:313078409 --> @kholia commented on GitHub (Jul 5, 2017): I think I made a mistake in creating the third file above! Here are two new hashes from files created with password "Я" with Russian as the language in Windows XP. ``` 1.mny:$money$0*00b81d0326f5e440*407472c8 2.mny:$money$0*ec97d8f325f5e440*f1f8aa0c ``` They both yield "?" as the password which matches the `Weird-R-russian-character-with-CP437.mny` result above. Update: I might still be doing something wrong. This stuff is very puzzling to me :-)
Author
Owner

@kholia commented on GitHub (Jul 5, 2017):

Ü	0xdc	
|	0x7c	0xdc & 0x7f == 0x7c

This does not compute, chr(0xdc & 0x7f) is '\' and not '|'. However, chr(0xfc & 0x7f) is '|', where 0xfc is the hex code for 'ü' (small case).

Update:

So your choice of ANSI codepage -> strip 8th bit -> UCS-2 seems to be the right one.

<!-- gh-comment-id:313082236 --> @kholia commented on GitHub (Jul 5, 2017): ``` Ü 0xdc | 0x7c 0xdc & 0x7f == 0x7c ``` This does not compute, chr(0xdc & 0x7f) is '\\' and not '|'. However, chr(0xfc & 0x7f) is '|', where 0xfc is the hex code for 'ü' (small case). Update: So your choice of `ANSI codepage -> strip 8th bit -> UCS-2` seems to be the right one.
Author
Owner

@magnumripper commented on GitHub (Jul 5, 2017):

Cool! I'll do some math again.

This does not compute, chr(0xdc & 0x7f) is '\' and not '|'. However, chr(0xfc & 0x7f) is '|', where 0xfc is the hex code for 'ü' (small case).

Oh, right. So that might mean only ASCII "a-z" are actually capitalized.

I wonder what happens if you use something like (normal CP1252) "€" as password. That's 0x80 so it would be 0x00 after stripping 8th bit. Or anything else from 0x81..0x9f - they will end up as control characters. On the other hand it doesn't matter much - get_key will report whatever original character we used and not a stripped one.

I have a version with the "ANSI codepage -> strip 8th bit -> UCS-2" ready to commit but I forgot it on a computer somewhere. Will push it later. Note to self: I still have to (probably) change it to only upper-case a-z.

<!-- gh-comment-id:313145072 --> @magnumripper commented on GitHub (Jul 5, 2017): Cool! I'll do some math again. > This does not compute, chr(0xdc & 0x7f) is '\\' and not '|'. However, chr(0xfc & 0x7f) is '|', where 0xfc is the hex code for 'ü' (small case). Oh, right. So that might mean only ASCII "a-z" are actually capitalized. I wonder what happens if you use something like (normal CP1252) "€" as password. That's 0x80 so it would be 0x00 after stripping 8th bit. Or anything else from 0x81..0x9f - they will end up as control characters. On the other hand it doesn't matter much - get_key will report whatever original character we used and not a stripped one. I have a version with the "ANSI codepage -> strip 8th bit -> UCS-2" ready to commit but I forgot it on a computer somewhere. Will push it later. Note to self: I still have to (probably) change it to only upper-case a-z.
Author
Owner

@magnumripper commented on GitHub (Jul 10, 2017):

Hopefully all is set now.

<!-- gh-comment-id:314051917 --> @magnumripper commented on GitHub (Jul 10, 2017): Hopefully all is set now.
Author
Owner

@magnumripper commented on GitHub (Jul 10, 2017):

We'd need some further tests to be really sure. Current code assumes ANSI codepage -> upper-case ASCII -> strip 8th bit -> UCS-2. However, it could also be ANSI codepage -> strip 8th bit -> upper-case ASCII -> UCS-2 and the difference is that some 8-bit character could become an ASCII lower-case letter after stripping, which would then have to be upper-cased.

<!-- gh-comment-id:314067639 --> @magnumripper commented on GitHub (Jul 10, 2017): We'd need some further tests to be really sure. Current code assumes `ANSI codepage -> upper-case ASCII -> strip 8th bit -> UCS-2`. However, it could also be `ANSI codepage -> strip 8th bit -> upper-case ASCII -> UCS-2` and the difference is that some 8-bit character could **become** an ASCII lower-case letter after stripping, which would then have to be upper-cased.
Author
Owner

@magnumripper commented on GitHub (Jul 10, 2017):

and the difference is that some 8-bit character could become an ASCII lower-case letter after stripping

OTOH, some cases of that is already in the test vectors, and does work. I'm just not sure that's universally the case.

<!-- gh-comment-id:314068180 --> @magnumripper commented on GitHub (Jul 10, 2017): > and the difference is that some 8-bit character could become an ASCII lower-case letter after stripping OTOH, some cases of that is already in the test vectors, and does work. I'm just not sure that's universally the case.
Author
Owner

@kholia commented on GitHub (Jul 10, 2017):

@magnumripper I can create more samples, if it helps. Just let me know the appropriate passwords to try.

<!-- gh-comment-id:314069677 --> @kholia commented on GitHub (Jul 10, 2017): @magnumripper I can create more samples, if it helps. Just let me know the appropriate passwords to try.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1701
No description provided.