Hey ! I'm David, a security consultant at Cryptography Services, the crypto team of NCC Group . This is my blog about cryptography and security and other related topics that I find interesting.

I haven't been posting for a while, and this is because I was busy looking for a place in Chicago. I finally found it! And I just accomplished my first day at Cryptography Services, or rather at Matasano since I'm in their office, or rather at NCC Group since everything must be complicated :D

I arrived and received a bag of swags along with a brand new macbook pro! That's awesome except for the fact that I spent way too much time trying to understand how to properly use it. A few things I've discovered:

you can pipe to pbcopy and use pbpaste to play with the clipboard

open . in the console opens the current directory in Finder (on windows with cygwin I use explorer .)

in the terminal preference: check "use option as meta key" to have all the unix shortcuts in the terminal (alt+b, ctrl+a, etc...)

get homebrew to install all the things

I don't know what I'll be blogging about next, because I can't really disclose the work I'll be doing there. But so far the people have been really nice and welcoming, the projects seem to be amazingly interesting (and yeah, I will be working on OpenSSL!! (the audit is public so that I can say :D)). The city is also amazing and I've been really impressed by the food. Every place, every dish and every bite has been a delight :)

I just discovered Cryptool. I can't believed I didn't know about that earlier.

The CrypTool Portal raises awareness and interest in encryption techniques for everyone.
All learning programs in the CrypTool project are open source and available for free. The CrypTool project develops the world most-widespread free e-learning programs in the area of cryptography and cryptoanalysis.

On their main page (cryptool portal) you have links to: Cryptool 1, Cryptool 2, JCryptool, Cryptool Online and Mystery Twister C3. Each project is a huge amount of information that was gathered by a group of volunteer (so yeah, for free). There are tons of tutorials and ways to play with ciphers to understand them. There is even a coppersmith and boneh-durfee explanation/implementation of the attacks I implemented these last months... This is huge. I feel like I'm just discovering the tip of the iceberg and it's all really confusing so here's a recap of what is everything, for me and for you :)

Cryptool 1

CrypTool 1 (CT1) was the first version of CrypTool. It was released in 1998 and allows to experiment with different cryptographic algorithms. CT1 runs under Windows. CT1 has two successors: CT2 and JCT.

It doesn't seem like it's useful to dig into this one since CT2 and JCT are supposed to be the updated versions. I've still installed it and it looks really old! But it's super complete and super fast so... still super useful.

Cryptool 2

CrypTool 2 (CT2) supports visual programming and execution of cascades of cryptographic procedures. CT2 also runs under Windows.

I skimmed through it seeing no resemblance to CT1. I have to spend more time with it but CT1 seemed way more educational and complete...

JCryptool

JCrypTool (JCT) is platform-independent and runs under Linux, Mac and Windows.

Haven't tried it yet but it looks like a multiplatform CT2

Cryptool Online

CrypTool-Online (CTO) was released in spring 2009. This tool allows to try out different algorithms in a browser / smartphone.

I'm gonna be honest here, not really nice compared to CT1 and CT2. Pretty limited.

Mystery Twister C3

You like riddles? You always loved to solve the crosswords in your newspaper? Or maybe you are just curious and want to find out about some of the ways to hide a secret (and possibily even to uncover it)? This is your place! Here at MysteryTwister C3 you can solve crypto challenges, starting from the simple Caesar cipher all the way to modern AES we have challenges for everyone.

The first riddle is just a sequence a number where you have to guess the last entry. Typical IQ test but it has been solved by 2138 people.

The 29th riddle is Hadstad broadcast attack and had only been solved by 102 people.

There are raffles every month so it might be a nice playground :) play here

The Doar-e team posted something about unprotected AES 128 whitebox, I haven't had time to read it yet (and it's pretty long!) but I got quoted in the last words so here's my repost :)

I posted previously about my researches on RSA attacks using lattice's basis reductions techniques, I gave a talk today that went really well and you can check the slides on the github repo

I wanted to record myself so I could have put that on youtube along with the slides but... I completely forgot once I got on stage. But this is OK as I got corrected on some points, it will make the new recording better :) I will try to make it as soon as possible and upload it on youtube.

I've watched The Imitation Game recently, a movie about Turing, and I was really disappointed at how they don't explain anything at all. I was also disappointed at how much time they spend drinking or doing something else than doing real work, or how they ended the movie before a potentially interesting second part of Turing's life (Imagine if they showed the persecution, it would have been kind of a Life is beautiful. So anyway, I ran into this explanation of Enigma:

It's my first survey ever and I had much fun writing it! I don't really know if I can call it a survey, it reads like a vulgarization/explanation of the papers from Coppersmith, Howgrave-Graham, Boneh and Durfee, Herrmann and May. There is a short table of the running times at the end of each sections. There is also the code of the implementations I coded at the end of the survey.

If you spot a typo or something weird, wrong, or badly explained. Please tell me!

I've Implemented a Coppersmith-type attack (using LLL reductions of lattice basis). It was done by Boneh and Durfee and later simplified by Herrmann and May. The program can be found on my github.

The attack allows us to break RSA and the private exponent d.
Here's why RSA works (where e is the public exponent, phi is euler's totient function, N is the public modulus):

\[ ed = 1 \pmod{\varphi(N)} \]
\[ \implies ed = k \cdot \varphi(N) + 1 \text{ over } \mathbb{Z} \]
\[ \implies k \cdot \varphi(N) + 1 = 0 \pmod{e} \]
\[ \implies k \cdot (N + 1 - p - q) + 1 = 0 \pmod{e} \]
\[ \implies 2k \cdot (\frac{N + 1}{2} + \frac{-p -q}{2}) + 1 = 0 \pmod{e} \]

The last equation gives us a bivariate polynomial \( f(x,y) = 1 + x \cdot (A + y) \). Finding the roots of this polynomial will allow us to easily compute the private exponent d.

The attack works if the private exponent d is too small compared to the modulus: \( d < N^{0.292} \).

To use it:

look at the tests in boneh_durfee.sage and make your own with your own values for the public exponent e and the public modulus N.

guess how small the private exponent d is and modify delta so you have d < N^delta

tweak m and t until you find something. You can use Herrmann and May optimized t = tau * m with tau = 1-2*delta. Keep in mind that the bigger they are, the better it is, but the longer it will take. Also we must have 1 <= t <= m.

you can also decrease X as it might be too high compared to the root of x you are trying to find. This is a last recourse tweak though.

Here is the tweakable part in the code:

# Tweak values here !
delta = 0.26 # so that d < N^delta
m = 3 # x-shifts
t = 1 # y-shifts # we must have 1 <= t <= m

A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970, that is used to test whether an element is a member of a set. False positive matches are possible, but false negatives are not, thus a Bloom filter has a 100% recall rate. In other words, a query returns either "possibly in set" or "definitely not in set". Elements can be added to the set, but not removed (though this can be addressed with a "counting" filter). The more elements that are added to the set, the larger the probability of false positives.

One of my professor is organizing a CTF, it's in french (sorry), it will start next month and should last for a week, and... there might be a challenge I've made for them =). I don't know if it has been accepted but here you go: HackingWeek 2015 if you are interested and you can speak french