Bitcoin Forum

Economy => Service Discussion => Topic started by: bitcoinBull on September 21, 2012, 10:50:02 PM



Title: How to use 2-factor auth on mtgox, even without a smartphone
Post by: bitcoinBull on September 21, 2012, 10:50:02 PM
So, bitcoins are now probably the most wanted target of hackers and trojan-botnet operators in search of easy profit. They are the most easily monetized score of digital theft, valued at face in BTC while credit card numbers are sold for pennies on the dollar.

Every time you download programs, or re-install windows using that iso you got a from a torrent, chances are ever greater that there is a trojan/virus. The chances are also good that it will go Fully UnDetected by most, if not all, Anti-Virus programs (botnet operators use a "FUD crypter" for this). If so, your mtgox password will be captured and added to the botnet database of login/password form submissions.

Then dude takes your mtgox funds.

I lost roughly 2000 USD from my MT.Gox account at 08:40 JST on the 31th of may 2012.

A lot of that going on.

"MtGox account got cleared out"
 - http://bitcointalk.org/index.php?topic=85533.0

"All BTC disappeared from my Mt. Gox account"
 - http://bitcointalk.org/index.php?topic=88368.0

Another:
 - http://bitcointalk.org/index.php?topic=80562.msg941759#msg941759

And another:
"My mtgox account got compromised, what can I do?"
 - http://bitcointalk.org/index.php?topic=84585.0

And on other services as well.  Here same thing happened to some GLBSE users:
 - http://bitcointalk.org/index.php?topic=84893.0

In none of these was the person using multi-factor authentication.  Mt. Gox has had Yubikey support for a while.  Mt. Gox accounts now support Google Authenticator:
 - https://mtgox.com/press_release_20120605.html


But not you! Because you used 2-factor auth for withdrawals and dude only has your mtgox password, not your OTP private key.
 

Step 1:

Go to your mtgox security center and click "ADD NEW" under software authenticators.

https://i.imgur.com/1MkC7.png

Take a screenshot of this window, print it out, and lock it in a safe. Or copy/paste the secure private key and save it encrypted to a USB and lock that in a safe. Write it on a post-it, memorize it and then eat the post-it. Whatever you do, keep it secret but don't lose it.


Step 2:

If you have an android phone, install the google authenticator app for android (https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en). If you have an iOS device (iPod touch, iPad, iPhone), install the iOS app (http://itunes.apple.com/us/app/google-authenticator/id388497605).

If you have neither, you can use this html5 google authenticator app (https://github.com/gbraad/html5-google-authenticator). Download the zip file (https://github.com/gbraad/html5-google-authenticator/zipball/master), extract it and open the index.html in your browser.

Now click the plus sign and add your secure private key. You are only running a local html5 app, so your secure private key is not being shared with anyone. You can even do this on an offline computer; you don't have to be online to use your secure private key to generate a one-time-passcode.

https://i.imgur.com/AzERJ.png


Step 3:

Use your generated one-time-passcode in the mtgox security center.

https://i.imgur.com/ssuUl.png

This passcode changes every 30 seconds. That's how long you have to type it into mtgox and "save" your new 2-factor auth system.

https://i.imgur.com/n6Nr9.png


Step 4:

Add your new 2-factor method to "Withdrawal" to protect withdrawals.

https://i.imgur.com/PtHGK.png

https://i.imgur.com/dw3BQ.png


Step 5:

Also add it to "Security Center". Otherwise, anyone with your login password can simply go to security center and remove your 2-factor auth protection.

https://i.imgur.com/BKJcW.png

https://i.imgur.com/siZrn.png


Now a one-time-passcode is needed to remove 2-factor from withdrawals.
https://i.imgur.com/AtnVq.png


Step 6:

Your withdrawals are now protected.

https://i.imgur.com/IQwpi.png



CAVEAT on using the google authenticator html5 app:

Obviously, if you use your 2-factor "secure private key" on the same computer, it can be stolen along with the password. So pray that dude's trojan doesn't keylog everything, just login form passwords to sites like mtgox. Or use the google authenticator app on an offline computer. If you're ultra-paranoid, remember that your secure private key could be captured at set-up time when done on an insecure computer.

Also, the html5 app saves the secure private key to html5 localStorage, so click the (x) after use to remove it. Or clear it from the browser's cache/localStorage.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: koin on September 21, 2012, 11:04:49 PM
Or use the google authenticator app on an offline computer.

the clock on an offline computer will vary over time, which will make your otp give a bad result.  update the time manually if the otp is gives doesn't work.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: nedbert9 on September 21, 2012, 11:18:12 PM



This


This type of professional documentation for account security should have been developed by all the high profile Bitcoin sites that use Google 2FA.


It's a statement about their professionalism that they don't take the time to do this.




Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: markm on September 22, 2012, 08:58:56 AM
This seems to assume you have a phone? Yet subject/title said even without one?

Is it that if you have no phone you have to get a yubikey instead?

-MarkM-


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: phatsphere on September 22, 2012, 09:15:09 AM
Is it that if you have no phone you have to get a yubikey instead?
if you have no phone, you can use the html5 app.

And if you don't have a graphical front-end at all (text-only terminal console), there is a python script on github that does the hmac hash calculation for you.

h


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: sinner on September 22, 2012, 10:22:05 AM
is there a way to use 2 factor auth on your bitcoin wallet?


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: bitcoinBull on September 22, 2012, 11:59:05 AM
Is it that if you have no phone you have to get a yubikey instead?
if you have no phone, you can use the html5 app.

And if you don't have a graphical front-end at all (text-only terminal console), there is a python script on github that does the hmac hash calculation for you.

h

btw, if you use that python script (https://github.com/tadeck/onetimepass), you have to add padding to the "secure private key" mtgox provides (other google auth apps will accept the secret key without padding). So "RPAAJZCGOW7NSAAJCFRCCHIN44" with base32 padding becomes "RPAAJZCGOW7NSAAJCFRCCHIN44======".

Code:
>>> import hmac, base64, struct, hashlib, time
>>> import onetimepass as otp
>>> my_secret = "RPAAJZCGOW7NSAAJCFRCCHIN44======"
>>> otp.get_totp(my_secret)
956735


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: foo on September 22, 2012, 11:23:02 PM
Very cool, thanks for the guide. Put up a donation address and I will send you a few bitcents for your trouble. ;D

I also found that the HTML5 app works in Opera Mobile, so I now have Google Auth on my Nokia (Symbian) phone!


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: bitcoinBull on September 23, 2012, 01:55:27 AM
Very cool, thanks for the guide. Put up a donation address and I will send you a few bitcents for your trouble. ;D

I also found that the HTML5 app works in Opera Mobile, so I now have Google Auth on my Nokia (Symbian) phone!

You're very welcome. tip jar: 1DUCK7StixdPxMCia8qgqQ6zoaGRdGRnqU


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: buddrulez on September 23, 2012, 06:31:00 PM
NIce work on the tut very handy ifor! I will throw some your way aswell soon thanks!


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Hasimir on September 24, 2012, 08:46:13 PM
As an alternative to deleting the entry (on computers rather than phones) when you're done, just store the entire GAuth directory on an encrypted volume (e.g. TrueCrypt) and only mount it when you need it.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: bitcoinBull on September 24, 2012, 09:04:30 PM
As an alternative to deleting the entry (on computers rather than phones) when you're done, just store the entire GAuth directory on an encrypted volume (e.g. TrueCrypt) and only mount it when you need it.

That's a good idea, but it won't work. The GAuth page/app uses html5 localStorage, so the entry/"secret key" gets saved to the browser's data/cache folder, not to the folder with the GAuth html and javascript files.

You could edit the GAuth javascript file and replace the hardcoded example alice@google.com. Then it would be contained in the Gauth folder.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Hasimir on September 25, 2012, 07:30:49 AM
btw, if you use that python script (https://github.com/tadeck/onetimepass), you have to add padding to the "secure private key" mtgox provides (other google auth apps will accept the secret key without padding). So "RPAAJZCGOW7NSAAJCFRCCHIN44" with base32 padding becomes "RPAAJZCGOW7NSAAJCFRCCHIN44======".

Code:
>>> import hmac, base64, struct, hashlib, time
>>> import onetimepass as otp
>>> my_secret = "RPAAJZCGOW7NSAAJCFRCCHIN44======"
>>> otp.get_totp(my_secret)
956735

Yep, that works.  Is there a way to report the number of seconds the OTP is valid for?  I can only see the check for whether it's true or false (and invoking that in the same script will always return true).


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Hasimir on September 25, 2012, 07:34:41 AM
As an alternative to deleting the entry (on computers rather than phones) when you're done, just store the entire GAuth directory on an encrypted volume (e.g. TrueCrypt) and only mount it when you need it.

That's a good idea, but it won't work. The GAuth page/app uses html5 localStorage, so the entry/"secret key" gets saved to the browser's data/cache folder, not to the folder with the GAuth html and javascript files.

You could edit the GAuth javascript file and replace the hardcoded example alice@google.com. Then it would be contained in the Gauth folder.

Ah well, the Python script will be good enough for me.  Which takes care of that problem.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Korbman on September 25, 2012, 03:40:31 PM
Excellent tutorial, and well written. We should see more like this!


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Stephen Gornick on October 22, 2012, 04:58:29 AM
Two-factor provides security when every withdrawal or security change (e.g., change password, e-mail address, remove two-factor, etc.) action will require a new OTP to be entered.

This is addressed in this thread:

A plea to exchanges ... lets do 2 factor right!
 - http://bitcointalk.org/index.php?topic=109424.0

If your exchange or EWallet provider claims to have two-factor but doesn't do two-factor right, let them know otherwise they'll continue thinking they are protecting their customers which can be even worse, due to having a false sense of security ("oh ya, I have two factor -- I'm safe storing even larger amounts there now!").

Here's a list of EWallets where two-factor is offered:
 - http://bitcoin.stackexchange.com/a/4114/153


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: jborkl on October 22, 2012, 05:51:14 PM
and a Gox yubikey is only $29 last time I checked.

They sent me one for free,  it is really I nice piece of hardware.

short press and long press. So you have built in additional press to withdraw


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: no name on February 12, 2013, 08:12:31 AM
Or use the google authenticator app on an offline computer.

the clock on an offline computer will vary over time, which will make your otp give a bad result.  update the time manually if the otp is gives doesn't work.

I tried to set 2fa on mtgox use this method via offlline computer (mini winxp on hirens boot usb) and get wrong otp. I had set  time and date same in second and get different otps. Online (same comp as mtgox session) generated otp well matched.

any advice, what is going wrong? thanks in advance!


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Hasimir on February 12, 2013, 10:45:26 AM
Or use the google authenticator app on an offline computer.

the clock on an offline computer will vary over time, which will make your otp give a bad result.  update the time manually if the otp is gives doesn't work.

I tried to set 2fa on mtgox use this method via offlline computer (mini winxp on hirens boot usb) and get wrong otp. I had set  time and date same in second and get different otps. Online (same comp as mtgox session) generated otp well matched.

any advice, what is going wrong? thanks in advance!

This is most likely the clock creep issue.  The OTP only lasts for 30 seconds, so if the clock is wrong it will not be calculated for the correct time as observed by Mt. Gox.  The best solution is to use a system connected to a time (NTP) server, otherwise you'll have to update the clock manually.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: foo on February 14, 2013, 09:09:46 AM
Or use the google authenticator app on an offline computer.

the clock on an offline computer will vary over time, which will make your otp give a bad result.  update the time manually if the otp is gives doesn't work.

I tried to set 2fa on mtgox use this method via offlline computer (mini winxp on hirens boot usb) and get wrong otp. I had set  time and date same in second and get different otps. Online (same comp as mtgox session) generated otp well matched.

any advice, what is going wrong? thanks in advance!
Wrong time zone on the offline computer?


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: no name on February 14, 2013, 09:27:34 AM

[/quote]
Wrong time zone on the offline computer?
[/quote]

I guess that mini xp don't have time zone setup!
I'll check it again today!

I done 2fa setup for bitcoincentral with same online comp and intend similar for mtgox until yubikey arrive.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: BitCoinNutJob on April 06, 2013, 04:56:03 PM

can someone confirm its safe to download the file given in this tutorial from the site github because i dont know github & OP has not signed in since march - no offense just a newbie donk :)


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: moni3z on April 06, 2013, 11:51:48 PM
https://github.com/gbraad?tab=activity

The guy who owns that github account last signed in 10 days ago, it's fine.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: BitCoinNutJob on April 07, 2013, 12:41:24 PM

ok cool guess its safe then, thanks


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: zxyzxy on April 25, 2013, 07:46:09 AM
Or use the google authenticator app on an offline computer.

the clock on an offline computer will vary over time, which will make your otp give a bad result.  update the time manually if the otp is gives doesn't work.
hey, i used this setup to add OTP to my bitstamp account (any additional layer of security they offer? its kinda lame that i cant even receive an email if there is a withdrawal, only a deposit..) well back to my original point, i added the OTP before march, usually i was logged on 2-3 takes, now after DST it takes 10-15 takes for me to log in.. what am i doing wrong? it does not make sense to chance the computer time back to what it was before summer time.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Loozik on April 29, 2013, 09:25:00 PM
Hello,

Newbie here asking for help setting up 2 factor auth on mtgox using a smartphone. A kind soul is kindly asked to help. The present state:

1. I have an account at Mtgox and want to add Google Authentication service in Mtgox in Security Systems.

2. I bought an Android phone yesterday.

3. I downloaded Google Authenticator into my phone and get the following sentences / commands on the phone after starting this app:

First screen

With 2-step verification , whenever you sign in to your Google Account you will need:
1. Your password (non-clickable)
2. A code that this app will generate for you (non-clickable)

Begin setup (clickable command which I click and arrive at):

Second screen that shows:

Add an account (non-clickable):
___________________
Manually add an account (non-clickable)
Scan a barcode (clickable; Q1: Is barcode reading app built-in Google Authenticator so that I do not need to download any other additional application?)
Enter provided key (clickable; Q2: Should I type Mtgosx's ''Auth Name'' or ''Standard Private Key'' or ''Secure Private Key''?)

Q3: Are ''scan barcode'' and ''add an account'' interchangable, meaning that performing any of the two will result in a success or do I need to both scan the barcode and enter the key?
_______________________
Available Google accounts (non-clickable)
xyz@gmail.com (clickable; Q4: is it advisable to create a new Google Account or is it okay if I use the existing one?)

Q5: Do I need to reveal my Google Account or this option is only for Gmail?

Thank you.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: pandemic on May 14, 2013, 12:22:35 PM
I just implemented 2-factor authentication in gox and a few pools. What happens if I lose the device with my google authenticator on it? 


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Stephen Gornick on May 14, 2013, 10:15:33 PM
I just implemented 2-factor authentication in gox and a few pools. What happens if I lose the device with my google authenticator on it? 

Each E-Wallet vendor may have differing practices. 

With Mt. Gox, I believe you need to re-verify your identity (sending in a new copy of your ID).  They might ask some questions, like how much was your balance, the amount of your last deposit, etc.

Google has a method to move the Google auth OTP stuff from one phone to the next, but I'm not sure if that helps with lost phones.

What you can do is copy the "secret" that is shown (it's just a string), or print out the QR code, so you have a backup of it so that you can re-load the code to a new device if you happen to lose your existing device.    Since you can't re-display the secret you are already using, you'ld need to remove OTP then re-add it and save a copy of the new secret code.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: dishwara on May 15, 2013, 08:53:45 PM
Mtgox gave this thread link when i asked about 2FA.
But they didn't told anywhere what will do to login if phone lost.

Thanks Stephen Gornick for good trick/idea.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: tclo on May 17, 2013, 06:43:09 PM
Thanks for the help with this and I use it on Gox, Bistamp and CampBX now..can't hurt to have that added layer of security


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: clipcoins on May 19, 2013, 09:00:06 AM
bump for a valuable thread that could save people a lot of hassle and money.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: malevolent on May 20, 2013, 08:42:07 PM
In case anyone didn't know, the Google authenticator is not limited to Android, iOS and BlackBerry devices there are a few unofficial google authenticators that will work on Symbian devices (e.g. a lot of Nokia's older phones), I'm using this one: https://code.google.com/p/lwuitgauthj2me/ on my 5800XM.

What you can do is copy the "secret" that is shown (it's just a string), or print out the QR code, so you have a backup of it so that you can re-load the code to a new device if you happen to lose your existing device.    Since you can't re-display the secret you are already using, you'ld need to remove OTP then re-add it and save a copy of the new secret code.

Thanks for the tip ;)
I would just add: keep the key in a safe place e.g. on a separate memory stick.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: dooglus on May 20, 2013, 10:50:49 PM
Here's the Python script that I use.  It's based on one I found on StackExchange, but adapted to take command-line arguments, and to do the secret padding correctly.

If you give it just one argument it gives you the TOTP code (which most sites use), and if you give it a 2nd argument, it gives you the HOTP code, which isn't time-based.  That's the kind that bitfloor used.

Code:
#!/usr/bin/env python
#
# calculate google authenticator codes
#
# usage:
#
#  for Time-based One-time Passwords (TOTP), supply just one argument: the secret
#
#  for HMAC-based One-Time Passwords (HOTP), supply two arguments: the secret, and the counter
#      the counter should go up by one each time you generate a password
#
import base64, hashlib, hmac, string, struct, sys, time

def get_hotp_token(secret, number):
    h = hmac.new(base64.b32decode(secret, True), struct.pack(">Q", number), hashlib.sha1).digest()
    o = ord(h[19]) & 15
    return (struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000

def get_totp_token(secret):
    return get_hotp_token(secret, int(time.time())//30)

def usage():
    sys.stderr.write("Usage: %s <secret> [ number ]\n")
    sys.exit(1)

argc = len(sys.argv)
if argc < 2 or argc > 3:
    usage()

secret = sys.argv[1]
secret += '======='[:7-((len(secret)-1)%8)]

if argc < 3:
    print "%06d" % (get_totp_token(secret))
else:
    number = string.atoi(sys.argv[2])
    print "%06d" % (get_hotp_token(secret, number))

Always remember to put a space at the start of your command line when running it so it doesn't get into the bash history file.  Alternatively create an alias in your .bashrc file so you can run it without having to type the secret each time (but then of course your secret is in the .bashrc file in plain text).


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Xer0 on June 01, 2013, 06:28:38 PM
I also found that the HTML5 app works in Opera Mobile, so I now have Google Auth on my Nokia (Symbian) phone!

OM is slooow on Symbian. try a J2ME TOTP implementation!


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: starsoccer9 on June 10, 2013, 01:35:10 AM
Does anyone know a good program to do this.

I found http://www.toms-world.org/blog/google_authenticator which lets me use mulitple sites which is really nice, but mtgox wont work. The whole program crashes on me. I tried adding the six equal signs like stated to make it a base 32 or w.e. but it didnt work. Any advice is appreciated.


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Financisto on June 17, 2013, 03:30:34 AM
Congratulations and thanks for the well done tutorial.

Cheers!


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: BitCoinNutJob on July 03, 2013, 10:20:12 PM

retarded question does this work for BTC-e ?


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: BitCoinNutJob on July 04, 2013, 07:43:55 AM
anyone?


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: davidpbrown on August 12, 2013, 06:45:32 PM
Great abc - thanks.

I'm surprised that two versions - one on computer offline html and one on phone, are providing different keys and yet they both work.



Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: Stephen Gornick on August 15, 2013, 12:19:47 AM
does this work for BTC-e ?

In June, BTC-E added two-factor authentication:
 - https://btc-e.com/profile#security/2fa

So yes, any TOTP client such as this browser-based one will work with BTC-E's two-factor auth.

List of exchanges with two-factor authentciation:
 - http://bitcoin.stackexchange.com/questions/4113


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: jerethdaminer on November 29, 2013, 05:17:51 PM
really useful post op, should have been on goxes site :)


Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: alouette on December 23, 2013, 10:12:38 AM
Hello,

I've generated an OTP auth on mtgox, and noticed it's not possible to retrieve the qrcode or secret keys once you've set it up. Since I don't want to only keep this on my phone (which could break or be stolen), I generated another OTP. Do you know if it's possible then to delete the first OTP on mtgox, since it's no longer used? In the case I use it by mistake in the future, it won't be properly backed up.



Title: Re: How to use 2-factor auth on mtgox, even without a smartphone
Post by: btcven on January 20, 2014, 01:36:38 AM
is there a way to use 2 factor auth on your bitcoin wallet?

Electrum will have this option soon