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.

# Magma vs Sage vs Pari

## posted February 2015

I was looking for a way to know what are the real differences between magma, sage and pari. I only worked with sage and pari (and by the way, pari was invented at my university!) but heard of magma from sage contributors.

From the sage website: The Sage-Pari-Magma ecosystem

The biggest difference between Sage and Magma is that Magma is closed source, not free, and difficult for users to extend. This means that most of Magma cannot be changed except by the core Magma developers, since Magma itself is well over two million lines of compiled C code, combined with about a half million lines of interpreted Magma code (that anybody can read and modify). In designing Sage, we carried over some of the excellent design ideas from Magma, such as the parent, element, category hierarchy.

Any mathematician who is serious about doing extensive computational work in algebraic number theory and arithmetic geometry is strongly urged to become familiar with all three systems, since they all have their pros and cons. Pari is sleek and small, Magma has much unique functionality for computations in arithmetic geometry, and Sage has a wide range of functionality in most areas of mathematics, a large developer community, and much unique new code.

I also noticed that Sage provides an interface to Shoup's NTL through ntl. functions. Good to know!

1 comment

# A Brief History of NSA Backdoors.

## posted February 2015

here's an entertaining piece about NSA backdoors through history: http://ethanheilman.tumblr.com/post/70646748808/a-brief-history-of-nsa-backdoors

1997 Lotus Notes: The NSA requested that Lotus weaken its cryptography so that the NSA could break documents and emails secured by Lotus notes. This Software was used by citizens, companies and governments worldwide.

comment on this story

# Get settled in Bordeaux: the true guide.

## posted February 2015

I'm leaving soon for Chicago and I haven't found the "let's give you a crash course of the city's inside" kind of guide I was looking for. I've also wanted for a long time to write a no bullshit guide on how to manage moving to Bordeaux. So here it is. It's gonna be short, concise and maybe not very ethical.

# Apartment

• avoid the only hostel of the city at all cost
• avoid the kind of agencies where you have to pay a fee (more than 100€ usually) to be able to visit places.
• if you are looking for an apartment during July, August, September... you're in for a bad time. Don't bother finding a real place, just find a sublet for a couple months until things calm down.
• how to find a place? Go on leboncoin (and nowhere else). check "particuliers" to have only landlords, refresh the page and call asap. Always have plenty of documents on you because if you find the place of your dream you might have to fill and sign on the spot. If you don't know what documents you need ask the first landlord you call.
• If you can't have a garant (guarantor) then check out Clé Acquitaine
• need furniture ? cutlery? a bike? Wait for periods when people are leaving: December/January or May/June. People dump free stuff in the streets (really) or sell them for an incredible low price. The Erasmus facebook group of the current year is where it's at. Don't hesitate to bargain, and take your time.
• see the map I posted here? You want to live in the yellow or the orange. The city is pretty small so the other colors should be ok as long as you don't go too far. Never go to the other side of the river though.

# Transports

• you should buy a bike. Not too expensive because you will probably get it stolen.
• don't pay for a pass, you will never see ticket inspectors. And if you meet one, be sure to have one ticket on you so that you can get a 50% discount on your fine!
• need to go to the airport ? Take the line 1 at Quinconces.

# Food

• Never go to KFC and subway. Nobody go there and it's never fresh. Avoid 2€ kebabs. People will tell you about the Coluche being the best kebab place of the city but you will want to avoid this as well. L'Entrecôte and Fufu have huge lines but they are not that special. Go check out Santosha and Pitaya, amazing thaï/vietnamese places.
• check Del'ice n'coffee or Verde Nero.

# Drinks

• iBoat should be a safe bet. Although it might be a bit selective and far away. La Plage is the biggest club I've been in France, it's close to the center, it's free on Thursday and it's full of girls.
• There are quizzes everyday in Bordeaux. Just ask your favorite bars. Avoid Place de la Victoire. Try not to always go to Charles Dickens or HMS or...
• La Maison du Vin. Go to this place. As much as you can. It's cheap, classy and the wine is very, very, very good. Try some Sauternes or some Loupiac or some Montbazillac.
• There are other more expensive places you can drink wine at. Check La Bbelle Campagne or in the same street rue des bahutiers.
• I said earlier never to go to the dark side of Bordeaux (across the river), but you can go if you want to see Darwin. It's a place with many things to do and I won't spoil it for you.
• If you need to buy alcohol late. There is a casino that sells until 10pm near the tram tracks between Victoire and Musée d'Acquitaine. Other small shops Cours Victor Hugo or Cours de l'Yser might as well. After 10pm check around Place du Parlement and you will find some shops selling illegally.

# Internet & Phone

• every year in june/july/august/september even november. When people move and need to subscribe to a new internet company, you usually have extremly cheap offers where you would pay like 2€/months for a year instead of 20. Check vente-privee.com this is where everything is at.
• still on vente-privee.com, and during the same periods, you will find mobile company doing the same agressive offers. This is the moment to get real cheap plans. It really doesn't matter what company, they are all the same. Although you might not have a great internet connection with "Free".
comment on this story

# Firefox Time Tracker : update 2

## posted February 2015

I shipped!

You can get the .xpi on the github repo. Just open it with Firefox and no restart is needed! (Ctrl+O in firefox)

For now it's very basic. You will see this icon next to the close button:

Yes I know I should create a custom icon :D but I was too busy coding. You will then see some basic statistics of the day.

I'm now working on making this page nice with pretty graphics and more statistics (week, month, tracking of the most visited website of the week...).

So if you want to try my plugin, know that it works (so far)! And that you should pay this blog a visit because I'm planning on updating it.

comment on this story

# A tutorial on how to get into an admin account on ANY windows.

## posted February 2015

A step by step tutorial showing you how to get admin credentials on a windows machine: http://imgur.com/gallery/H8obU

tl;dr:

• reboot in start-up repair mode
• thanks to notepad replace sethc 1 with cmd
• so now when you press 5 times on shift it will call cmd instead of sethc 1
• you know have a shell, use command net localgroup Administrators to get a list of the admins
• type net user <ACCOUNT NAME HERE> * to change one account's password.

If you're looking for a "fix", microsoft advise you to turn off sticky keys all completely

And here's another exploit for windows 98

Note that as soon as you can access the hard drive, you don't need to use the first trick and can switch around programs in system32 as you wish (except if windows is encrypted with bitlocker). For example you can do this with an ubuntu live cd and swap cmd with the magnifier tool and you will be able to do the same thing.

comment on this story

# Firefox Time Tracker

## posted February 2015

I always thought I could reduce the amount of time slacking if I could track my time on facebook, reddit, hackernews... like I track my calories intake to reduce my weight. I couldn't find a good firefox plugin for that so I decided to make one.

I'm opensourcing the code right here: https://github.com/mimoo/FirefoxTimeTracker

I'm pretty surprised with Firefox SDK and it's actually easier than what I thought to build a browser plugin. It might also help that everything Mozilla documents is clear and pretty.

At the moment the code successfully logs the time passed on different websites across sessions. It just lacks nice graphs. If you want to try it just wait a couple days until I ship.

comment on this story

# Kleptography: hidding a private key in plain sight

## posted January 2015

from wikipedia:

A kleptographic attack is an attack which uses asymmetric encryption to implement a cryptographic backdoor. For example, one such attack could be to subtly modify how the public and private key pairs are generated by the cryptosystem so that the private key could be derived from the public key. In a well-designed attack, the outputs of the infected cryptosystem would be computationally indistinguishable from the outputs of the corresponding uninfected cryptosystem. If the infected cryptosystem is a black-box implementation such as a hardware security module, a smartcard, or a Trusted Platform Module, a successful attack could go completely unnoticed.

I've seen implementations of this in the wild, here on reddit (python) and here on lobsters (C#)

comment on this story

# Explanation of Shellshock

## posted January 2015

Here's an awesome explanation of shellshock: https://bitbucket.org/carter-yagemann/shellshock/src/f0a88573f912?at=master

This repository contains useful documents which I have written to help educate the cybersecurity community on the "ShellShock" bash vulnerability. These documents are designed to help facilitate learning, including on how to identify possibly vulnerable services and how to remediate such vulnerabilities.

It's actually the clearest explanation I've seen on the subject.

Made by these guys from Syracuse:

• Carter Yagemann
• Amit Ahlawat
comment on this story

# One example of a crypto backdoor: NSA's backdoor in Lotus-Notes

## posted January 2015

If I understand the article correctly, when exporting encrypted content with Lotus-Notes, 24 bits of the 64 bits key would be encrypted under one of the NSA's public key and then appended to the encrypted content (I guess). This would allow NSA to decrypt those 24 bits of key with their corresponding private key and they would then have to brute force only 40 bits instead of 64 bits.

This shouldn't allow any bad attacker to get any advantage if they don't know the NSA's private key to decrypt those bits. And if they do acquire it, and they do decrypt 24bits of key, they would still have to have the computing power to brute force 40 bits of key. I have no idea what I'm talking about but I have the feeling the NSA might be the most powerful computing power when it comes to brute forcing ciphers.

comment on this story

# Awk in 20 minutes

## posted January 2015

I posted a tutorial of awk a few posts bellow. But this one is easier to get into I found. It says Awk in 20 minutes but I would say it takes way less than 20 minutes and it's concise and straight to the point, that's how I like it.

http://ferd.ca/awk-in-20-minutes.html

EDIT1: And here's a video of someone using a bunch of unix tools (awk, grep, cut, sed, sort, curl...) to parse a log file, pretty impressive and informative: https://vimeo.com/11202537

EDIT2: Here's another post playing with grep, sort, uniq, awk, xargs, find... http://aadrake.com/command-line-tools-can-be-235x-faster-than-your-hadoop-cluster.html

comment on this story

# How Differential Power Analysis (DPA) works? An explanation of the first paper from Kocher et al (1998)

## posted January 2015

I wanted to get into educational videos and this is my first big try (of 13minutes). I made some quick animations in Flash and some slides and I recorded it. I didn't want to spend too much time on it. It doesn't feel that clear, my English kinda got stuck sometimes and my animations were... crappy, let's say that :D but it's a first try, I will release other videos and improve on the way hopefully :) (I really need to get more pedagogical). So I hope this will at least help some of my fellow students (or people interested in the subject) in understanding Differential Power Analysis

Note: I made a mistake at the start of the video, DPA is non-invasive (source)

1 comment

## posted January 2015

$cur = 'plaintext'$cur  = md5($cur)$salt = randbytes(20)
$cur = hmac_sha1($cur, $salt)$cur  = cryptoservice::hmac($cur) [= hmac_sha256($cur, $secret)]$cur  = scrypt($cur,$salt)
$cur = hmac_sha256($cur, \$salt)

the explanation is here

tl;dr: the md5 is here for legacy purpose, cryptoservice::hmac is to add a secret salt, scrypt (which is a kdf not a hash) is for slowing brute force attempts and the sha256 is here for shortening the output.

comment on this story

# How does TOR works

## posted January 2015

I've always wondered how TOR (The Onion Router) worked and was a bit scared of digging into it. After all, bitcoin is pretty hard to grasp, how would TOR be different? But I found out that TOR was actually a pretty simple concept!

The official explanation is top notch. To sum up, instead of sending a packet to the destination (google.com for example), you choose a route of TOR nodes that will lead to that destination (usually 3 nodes). And for efficiency purpose you will keep that route for 10 minutes)

The idea is similar to using a twisty, hard-to-follow route in order to throw off somebody who is tailing you

• The first node only see who's sending the packet (you) and who it is for (the second node). It decrypts the payload and send it to the second node.
• The second node only sees it came from the first node, decrypts the payload and send it to the third node
• The third node sees it came from the second node, decrypts the payload and send it to the destination (in clear if you don't use ssl)

From TOR's FAQ:

Can't the third server see my traffic?
Possibly. A bad third of three servers can see the traffic you sent into Tor. It won't know who sent this traffic. If you're using encryption, such as visiting a bank or e-commerce website, or encrypted mail connections, etc, it will only know the destination. It won't be able to see the data inside the traffic stream. You are still protected from this node figuring out who you are and if using encryption, what data you're sending to the destination.

To be able to do this, this is where the encapsulation or rather onion routing technique is used.

As we know the route we are going to take, we can encrypt several time our packet. For example: we'll encrypt the packet router B will have to send to router C with the public key of router A. So when router A opens the packet and decrypts it with its private key, he only sees the encrypted payload destined to router B. He can then send it to router B and the latter will decrypt it and send the payload to router C and on and on. I think the picture is clearer than my explanations.

Voilà! Not that hard huh?

1 comment

# Morse code in a pop song

## posted January 2015

Amazing article on the verge about how the army created a song hiding a message ("19 people rescued. You’re next. Don’t lose hope") so that hostages of the FARC could hear it on the radio.

This is a genius idea for concealing a message! Not really crypto, but kinda cool none the less. I knew about Stenography and I also posted about transforming your message into spam as a way of hiding your message, but this is cool on a different level. Even the song is catchy ^_^

There was this disturbing video of a captive soldier in a North Vietnamese prison who when forced to do a fake interview, blinked the Morse Code 'T-O-R-T-U-R-E'.

comment on this story