0%
0%

Aleksandar Bradic

CTO, Supplyframe // Contributor-at-Large, Hackaday

Pasadena, CA
Send a private message
Similar accounts worth following
aleksandar-bradic
Send a private message

This user joined on 12/20/2013.

The Gathering LA2014 Hackaday at Open Hardware Summit

View all 20 projects

View all 40 projects

  • HackChat: The First 42 Posters

    01/10/2018 at 16:47 2 comments

    ... perhaps the next 42 should be a bit less dark ;)

  • System.nanoTime() for fun and profit

    11/01/2017 at 16:53 0 comments

    I was reading  Colin O'Flynn's excellent "Forget Not the Humble Timing Attack" article in PoC | GTFO this morning, and I thought I should check how easy timing attacks would be in Java (I know, I know...). 

    Anyway, turns out the System.nanoTime() is quite handy. Here's the sample demo that uses it to measure method invocation times for different key sizes:

    import java.util.UUID;
    import java.util.Arrays;
    public class TimingPoC {
     private static char[] secret = UUID.randomUUID().toString().toCharArray();
     /** leaky password check **/
     public boolean checkSecret(char[] pwd) {
     for (int i=0; i<pwd.length; i++) {
     if (pwd[i] != secret[i]) {
     return false;
     }
     }
     return true;
     }
     public void start() {
     for (int i=1; i<secret.length; i++) {
     char[] candidate = Arrays.copyOfRange(secret, 0, i);
     long[] times = new long[5];
     for (int it=0; it<times.length; it++) {
     long start = System.nanoTime();
     checkSecret(candidate);
     times[it] = (System.nanoTime() - start);
     }
     Arrays.sort(times);
     System.out.println(i + "\t" + times[(int)Math.floor(times.length/2)]);
     }
     }
    }
    

     And here are the corresponding (nanosecond) response times:

    One simple linear regression later...

    Call:
    lm(formula = call_time ~ key_length)
    Residuals:
     Min 1Q Median 3Q Max 
    -37.185 -21.977 -10.429 -1.134 214.983 
    Coefficients:
     Estimate Std. Error t value Pr(>|t|) 
    (Intercept) 111.9210 16.7010 6.701 1.24e-07 ***
    key_length 16.5838 0.8092 20.495 < 2e-16 ***
    ---
    Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    Residual standard error: 48.35 on 33 degrees of freedom
    Multiple R-squared: 0.9272, Adjusted R-squared: 0.925 
    F-statistic: 420 on 1 and 33 DF, p-value: < 2.2e-16
    

    We can easily conclude that every extra character in the key length increases the method response time by 16.5 nanoseconds, which is the information that given naive password check information leaks. Now, all we need to do is keep increasing test key length until response times stop growing, and we'll have our target key size.

    One thing to keep in mind with the approach above is that, on a modern OS, given times will not be deterministic. So repeated measurements are needed in order to get a "smoothed" value (in the code above value used is the median of 5 measurements). That said, though, in purely statistical terms, even more measurements would yield a more stable estimate, in this particular case, it's not necessarily true. Here's an example of a median based on 5000 samples:

    Why do you think this is the case? :) 

  • Random Bits & Pieces

    12/26/2016 at 20:56 0 comments

    Read more »

View all 10 pages

Things I've Built

uRSA

FPGA RSA Crypto Core on Xilinx Spartan-II

View all

Share this profile

Share

Bits

Log In/Sign up to comment

Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.

Michael Gardi wrote 03/24/2021 at 23:09 point

Thanks for your interest in my TMD-2: Turing Machine Demonstrator Mark 2 project Aleksandar.

Are you sure? yes | no

Dr. Cockroach wrote 11/04/2017 at 21:15 point

Good afternoon Aleksander and thanks for following me. I do tend to construct things a bit different from most :-)

Are you sure? yes | no

Vijay wrote 10/27/2017 at 01:23 point

Thanks for the follow!

Are you sure? yes | no

SHAOS wrote 10/05/2017 at 00:45 point

Are you sure? yes | no

Radu Motisan wrote 09/07/2017 at 16:28 point

Thanks for liking #Ankle Booster  . Will you be at balccon in novisad?

Are you sure? yes | no

Aleksandar Bradic wrote 09/09/2017 at 18:09 point

Nah :\ Somehow I always miss it. Hopefully next year!

Are you sure? yes | no

Aleksandar Bradic wrote 09/05/2017 at 05:57 point

Are you sure? yes | no

Bharbour wrote 06/30/2017 at 03:26 point

Thanks for following my WIFI Board Project!

Are you sure? yes | no

Morning.Star wrote 06/10/2017 at 11:18 point

Hey Aleksandar, thanks for following #Cardware! Thanks to the seed funding I'll now be developing this further shortly. :-)

Are you sure? yes | no

Morning.Star wrote 06/17/2017 at 07:27 point

Thanks so much for supporting my work, it means a lot! :-) #DECAL is shaping up to be a generational development to Cardware, it was supposed to be 'a robot' ;-)

Are you sure? yes | no

Morning.Star wrote 01/20/2017 at 22:54 point

Hi Aleksandar, thanks for the follow. I noticed the cool Hackaday artwork in my feed, wondered who the artist was... :-)

Are you sure? yes | no

Aleksandar Bradic wrote 01/20/2017 at 23:19 point

Haha thank you!!

Are you sure? yes | no

danjovic wrote 12/09/2016 at 21:35 point

Hi Aleksandar. Thanks for following #Joy232 too! I've just uploaded a video showing it in action.

Are you sure? yes | no

Eric Hertz wrote 11/28/2016 at 20:19 point

Thanks for the like/follow, Aleksandar!

Are you sure? yes | no

Eric Hertz wrote 04/11/2017 at 01:22 point

thanksAgain++;  //And another!

Are you sure? yes | no

danjovic wrote 11/23/2016 at 13:42 point

And thanks also for following #DC-10

Are you sure? yes | no

danjovic wrote 11/22/2016 at 12:07 point

Thanks for following and for liking #VGA Blinking Lights

Are you sure? yes | no

Aleksandar Bradic wrote 10/11/2016 at 18:24 point

⡱⢎.io/alek

Are you sure? yes | no

Nolan Moore wrote 08/05/2016 at 21:38 point

Thanks for the follow on the Power Glove Project! :)

Are you sure? yes | no

[skaarj] wrote 06/13/2016 at 18:06 point

Thank you for the like on my retro futuristic automobile control panel project. I am sorry for the long delayed answer.

Are you sure? yes | no

Peter Walsh wrote 05/18/2016 at 19:53 point

Hey - thanks for the follow!

Are you sure? yes | no

Steve Schuler wrote 05/16/2016 at 17:03 point

Thanks for following my project!

Are you sure? yes | no

Become cool instantly

like Aleksandar Bradic and many others

AltStyle によって変換されたページ (->オリジナル) /