📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

Blogs >> evilcry's Blog

Created: Monday, December 25 2006 04:25.51 CST  
Printer Friendly ...
Xmas Cryptanalisys :)
Author: evilcry # Views: 5349

First of all, i would give you my best wishes for a Peaceful and Happy Christmas, i've published this post because, as someone already said, "this make me fell alive"

Here i'll talk about the cryptanalysis of a simple Binary Addition, but this can be usefull for people that have some Psion5 PDA file Encrypted ;)

Psion 5 PDA implements a very weak encryption system, here i'll demonstrate how we can obtain a fully clear plaintext from an encrypted block (a Cipher Only Attack).

The algorithm used is a simple Binary Addition:

Encryption phase: The key entered is added character by character (byte by byte) to the data to be encrypted. Here addition modulo 256 is used. The key is applied cyclically, once all bytes of the key have been used, the algorithm reverts to the first character until the text has been completely encrypted.

Decryption phase: The characters of the key have to be subtracted from the encrypted text modulo 256.

As previously said a Cipher Only Attack can be performed, we need to know:

1)Statistical Frequency: The characters which occur most frequently), but if we don't know this parameter, there is no problem, because we can use statistical tables, or at least a small bruteforce it's range is truly small, only 26 as the number of letters, more if we are working with not common languages (xenographyc tables are useful in this case).

2)The key length: We can determine the keylenght using Autocorrelation (which is an index of similarity for differents portions of text).
Each character had not an equal probability occurs, but the probability of two identical characters occurring is relatively large if they are separated by a multiple of the key length. Thanks to the Autocorrelation analisys, we can determine a "distance value", calculated between equal frequency values, this value is our Derived Key Lenght.

3)Discovering The Key: After we know the Key Lenght, throughout the Histogram analisys of every character of the key, we can determine the correct key char. It's important to underline that, in this process we have to assume a Most Common Character,
for example on english texts we can assume the 'e' OR the space ' '.


--------------------[Background Philosophy]----------->

The base concept that allowed this attack, is the The Unicity Distance, which is one of the fundamentals of Cryptanalisys.
The Unicity Distance, is the minimum amount of ciphertext (expressed in number of of chars) required to allow a computationally unlimited adversari to recovery the Encryption Key.

We can express this concept in more strict terms, as No = H(K)/D, where
No=Expected Unicity Distance
H(K)=Entropy of Key Space
D=Plaintext Redundancy (Referred to the Histogram Analisys)

In our case we have to introduce another parameter, t which is the period of our cipher. Assuming D as 3.2 bits/chars we have:

H(K)/D=lg(t!)/3.2

Using Stirling's Approximation we can rewrite the previous as:

t! Approximately Is Sqrt((2Pi*t))* (t/e)^t

As usual i exceded in the Math Back-Ground analysis :)
but reported informations should be enough for people that want to implement some Automatic Cryptanalisys Proggie :)

Again Merry Xmas and see you to the next post ;)




Add New Comment
Comment:









There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit