17.12.2012 Views

Viber Communication Security - Bad Request

Viber Communication Security - Bad Request

Viber Communication Security - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Experiments Chapter 3<br />

1 private class ProdServerConfig extends ServerConfig . IServerConfig<br />

2 {<br />

3 public ProdServerConfig ()<br />

4 {<br />

5 super ();<br />

6 this . url_activation_request = " https :// secure . viber . com / viber / viber . php ?<br />

function = ActivateUser ";<br />

7 this . url_registration_request = " https :// secure . viber . com / viber / viber . php ?<br />

function = RegisterUser ";<br />

8 this . url_country_request = " https :// secure . viber . com / viber / viber . php ? function =<br />

GetDefaultCountry ";<br />

9 this . url_deactivation_request = " https :// secure . viber . com / viber / viber . php ?<br />

function = DeActivate ";<br />

10 this . url_generate_device_key = " https :// secure . viber . com / viber / viber . php ?<br />

function = GenerateDeviceKey ";<br />

11 this . url_generate_device_key_done = " https :// secure . viber . com / viber / viber . php ?<br />

function = GenerateDeviceKeyDone ";<br />

12 this . url_update_phone_request = " https :// secure . viber . com / viber / viber . php ?<br />

function = UpdatePhone ";<br />

13 this . url_voip_host = " aloha . viber . com ";<br />

14 }<br />

15 }<br />

Listing 6: ProdServerConfig URL’s in class com.viber.voip.ServerConfig<br />

One could easily see that the generateSignature method uses a Hash-based Message Authentication<br />

Code (hmac) based on sha -256, and a statically configured secret key with the value 5eb6588086b6b2d054af80527b<br />

We suspect that before the method is executed, an xml -based request is built by other application<br />

code and then passed onto the generateSignature method which outputs a signature of that input.<br />

Once this is transmitted along with the xml -based request, it provides integrity of the contents of<br />

the request.<br />

Lastly, we have selected some interesting methods regarding sending/receiving messages. First,<br />

the code of the sendNewMessage method shown in listing 7. This method takes two parameters:<br />

the recipient’s number, the text of the message, and the current time in milliseconds, respectively.<br />

Amongst other things, it then passes these parameters on to the method insertNewMessage along<br />

with nine other static values.<br />

1 public void sendNewMessage ( String paramString1 , String paramString2 )<br />

2 {<br />

3 log (" sendNewMessage ␣ toNumber :" + paramString1 + ",text :" + paramString2 );<br />

4 insertNewMessage (null , paramString1 , paramString2 , System . currentTimeMillis () , 1,<br />

0, 1, 0, 0, 3, " text ", false );<br />

5 sendPendingMessages ();<br />

6 }<br />

Listing 7: Method sendNewMessage in com.viber.voip.messages.MessagesManager<br />

Since the actual insertNewMessage method is long and not very interesting, we decided to show<br />

the code of the createMessageValues method instead, see listing 8. The reason is that this method<br />

clearly shows the meaning of almost all the different parameters passed to the insertNewMessage<br />

method.<br />

30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!