How to decrypt 3DES in ECB mode (using a wordlist)? [closed]

I have some encrypted texts (encrypted with 3DES in ECB mode without salt).

My question: How can I decrypt them using a wordlist? (or without one)

Example:

Encrypted text:

Xfi+h4Ir6l7zXCP+N4EPvQ==


The wordlist for this:

foo
bar
marketing


The original text was before encrypting was: "marketing" (just to make the example full).

-

closed as off-topic by e-sushi♦, DrLecter, otus, poncho, archieAug 8 '14 at 2:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Requests for analyzing or deciphering a block of data are off-topic here, as the results are rarely useful to anyone else." – e-sushi, DrLecter, otus, poncho, archie
If this question can be reworded to fit the rules in the help center, please edit the question.

Aside from that, what are you asking? "How do I attackif I have a dictionary of possibly preimages" (on-topic) or "why don't this code work? (Off-topic) – figlesquidge Mar 4 '14 at 16:13
I don't know what are you talking about, thus that thing that you are talking about is open to the public on russian forums – evachristine Mar 4 '14 at 16:13
I updated the question – evachristine Mar 4 '14 at 16:18
@evachristine I know you really, really want us to tell you a piece of software to do this for you, but software recommendations are off-topic on this site. – mikeazo Jun 26 '14 at 20:20
@mikeazo Even more… as the question doesn’t ask much else than how to practically decrypt/break the ciphertext, it fits “Requests for analyzing or deciphering a block of data are off-topic here, as the results are rarely useful to anyone else.”. I would have close-voted accordingly, but that bounty currently blocks close-votes. (PS: I already fixed the software recommendations issue with an edit a minute before I noticed your comment.) – e-sushi Jun 26 '14 at 22:29

You have a ciphertext (or maybe multiple), a list of possible plaintexts, but no key. Therefore, your process would be

1. Generate random decryption key
2. Decrypt ciphertext with that key (base64 decode CT first)
3. See if result appears in your list of possible plaintexts
4. If it does, return that plaintext; otherwise goto 1

This is a basic brute force attack and will not work in any reasonable amount of time. The reason for this is that 3DES has too large of a key. Use of ECB is bad, but it does not necessarily imply that something will be easy to break and often requires lots of ciphertext to produce a break (at least in the case of the current application we are discussing, other applications can be rendered completely insecure due to ECB use).

-

After base64 decoding we get (hex) 5d f8 be 87 82 2b ea 5e f3 5c 23 fe 37 81 0f bd which has a size of two blocks.

Of your small word-list, only marketing has so many letters that it needs two blocks: m a r k e t i n as the first, g 07 07 07 07 07 07 07 as the second (or another padding, but this is a common one), and so can correspond to this ciphertext.

A word like foo fits in a block, eg: f o o 05 05 05 05 05, and so would give an 8 byte result. Not that we do use that ECB mode is used (no extra IV data like for CBC, a block goes to a block, and we need padding, unlike CTR mode). So if the plaintext was chosen from among the word-list, marketing is the only candidate.

-