Pages

Wednesday, 19 March 2014

When "usability outweighs the perceived risks" [Google]

Sometimes advantages of used solution outweighs potential security risk, situation like that opens wide field for black hats.

Introduction

Using Google as proxie is well known topic, ex. google translator, but recently I noticed also content downloading possibility, what creates a way more abuse possibilities.

Blogger "image from web"
When we want to add a new photo from web, there is created request like that:



 Url:
https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http://1.bp.blogspot.com/-FbuVMEv0Abg/Ut10Wpi_WFI/AAAAAAAAD1I/q1Pk4RPA2e4/s1600/Screenshot_2.jpg&container=blogger&gadget=a&rewriteMime=image/*

Opening that link will start downloading image in p.txt file, from address included in "url" parameter.  In this example "http://1.bp.blogspot.com/-FbuVMEv0Abg/Ut10Wpi_WFI/AAAAAAAAD1I/q1Pk4RPA2e4/s1600/Screenshot_2.jpg". What is exactly my .jpg, just with changed extension to text file. But let's see what can we achieve by changing the "url", or  "rewriteMime" parameter.

Threats


1)Malicious file download using google servers:

We can change url parameter to any page or file and thanks to rewriteMime, (http://en.wikipedia.org/wiki/MIME) we can give "advice for browser", what to use for opening this file, despite of default .txt format. Some of the browsers use that parameter (ex. firefox). It gives possibility to send malicious file, as google servers (File is being downloaded to google servers firstly and then to client)
So lets make some tests, by downloading files from dropbox and changing their mime parameters:

.docx and .pdf - popular files, often containing exploits.
https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=https://dl.dropboxusercontent.com/u/17580849/testing/test.docx&container=a&gadget=b&rewriteMime=application/msword

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=https://dl.dropboxusercontent.com/u/17580849/testing/test.pdf&container=a&gadget=b&rewriteMime=application/pdf


.zip that may contain malicious .exe
https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=https://dl.dropboxusercontent.com/u/17580849/testing/test.zip&container=a&gadget=b&rewriteMime=application/zip

Video:





In chrome and IE situation is better, they both recognize files as .txt, despite the Mime parameter change.

2)Bypass downloading content from websites blocked or marked as danger websites

Because everything is going though goggle servers, it lets to use content from sources, that maybe should be blocked for some reasons. So it can work as proxy.

3) Silence malware updates possibility

Default extension of file is .txt, but after downloading there is no problem for malware to change it to exe., so connecting this, with previously talked proxy possibility, it can be used by malware to make updates thought legit google servers.

Video: 




4) DoS using google servers
During tests, I didnt notice any security, as captcha or requests limit, so it gives possibility to make numerous requests of downloading file from target website and at the end the DoS attack. Attacker could choose big file on website, which using this method will be downloaded many times by fast google servers.


Conclusion

Web developers often encounter this kind of problem, the title which describes it, comes from email that I got from Google:



As we can see in Google opinion possible advantages are higher than the risk. Same situation we can observe right now (27.04), with Facebook, where it's possible to use notes service for downloading content from any website (cause DDos, when many people open the note) (more info: http://chr13.com/2014/04/20/using-facebook-notes-to-ddos-any-website/). The most realistic solutions seems to be monitoring such a service and trying to catch abuses.

Tuesday, 21 January 2014

Rejestracja istniejącego, lub jednoliterowego nicku [MyBB, phpBB]


Za namową Adama z Z3S postanowiłem opisać problem po polsku i przeprowadzić trochę więcej testów (dzięki za motywacje! :>).

Czym jest "zero width non jointer"
"zero width non jointer" jest znakiem o szerokości 0 pixeli, samodzielnie występuje jako niewidoczny znak. Więcej informacji: http://en.wikipedia.org/wiki/Zero-width_non-joiner

Znajdziemy go w tablicy znaków (Start > Wyszukaj "> "Tablica Znaków"),  zaznaczamy Widok zaawansowany i w wyszukiwanie wpisujemy "Zero Width Non-Joiner", naciskamy wybierz, a następnie kopiuj.




















Test popularnych for
Postanowiłem przetestować jak zadziała użycie go przy rejestracji na kilku popularnych forach.

  • Vbulletin&IpBoard 

Oba wydają się być bezpieczne,
‍‍‍Vbulletin przechodzi początkową walidacje, przy wpisywaniu, jednak po kliknięciu zarejestruj:








Podejście IpBoard bardziej mi się spododało, odrazu informuje, że można użyć tylko znaków a-zA-Z0-9





  • MyBB:

Potrzebujemy nicku 3 znakowego:






Teraz dodałem 2 znaki "zero width non jointer":






 Działa!









Ale rejestracja nicku jak 'a', może służyć jedynie zabawie, teraz spróbujmy zarejestrować istniejący nick, czemu by nie "admin" ?

Przed dodaniem znaku U+200c :




 

Po:












Zalogowano



Dodanie posta w temacie prawdziwego admina:
















Na następnym screenie, możemy zobaczyć 3 adminów i 2 użytkowników o nicku 'a':








Zgłosiłem już to do MyBB.

  • phpBB

Tym razem forum nie pozwala nam zarejestrować takiego samego, jednak nadal można nick jednoliterowy:







Zagrożenia:
Powiecie, że np. w MyBB "admin jest zielony i ma więcej gwiazdek", Prawda..., ale:
1. W prywatnej wiadomości, np z prośbą o nowe hasło, ludzie mogą tego nie zauważyć, szczególnie jeżeli użyjemy takiego samego avataru.
2. Możliwe jest stworzenie każdego nicku, więc atakujący może stworzyć konto o nicku zaufanego sprzedawcy, o takiej samej randze, a nabicie postów to nie problem.
3. Ludzie mogą popełnić błędy podczas wysyłania prywatnych wiadomości i wybrać nas, zamiast prawdziwego adresata.


Jak zaradzić:
Najlepszym sposobem, jest sposób zastowany przez IpBoard, czyli whitelist dla dozwolonych znaków, np. a-zA-Z0-9

Fix w MyBB stworzony przez Pawła Klebba:

Plik inc/datahandlers/user.php, linijka koło 73. Zamienić ją na:
$username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203), dec_to_utf8(8204) ), array(" ", "-", "", "", "", "", ""), $username);


Friday, 10 January 2014

Flash games security, or so called 'cheating', Part I











If you have ever been wondering how all these amazing score results in flash games are achieved, here you will find it out. I'm going to write set of articles about flash games security, this is part I and we will talk about cheating possibility during communication: client side - server.

Most of simple flash games are runned only on 'client side' and they have no communication with server until it wants to send your score to best results list. This makes it simply to cheat by changing values during that communication.

I'm going to show it step by step, we will use Tamper Data add-on for firefox which simply allows us to modify POST parameters in "real time". Of course we can use tools like Burp Suite, but for non advanced users, for this task, it's simpler to use add-on like Tamper Data.
Download:

I also set up testing environment with MyBB forum and flash games plugin 'GamesSection', I'm going to show it on pacman game, which is included by default with plugin, but it works with all the games that don't have server side control, during game.




















Before start the game we have to open Tamper Data (Tools -> Tamper Data) and we got window pop up:



















Now we can click 'Start Tamper' and start playing, its advised to close other websites, otherwise we will get many pop ups, with every tab page requests.
So we simply play game, until our lives finish:




















When we lose, website will try to save our points for the ranking, so Tamper Data will pop up:








Of course we click Tamper, and we can uncheck continue box. Request details will come:











Now in Post_Data, we have to find where scores are included, we can can do it by looking manually, or search with ctr+f for value of points we had at the end (70 in my example). It appears here in 3 places, but only last value 'gscore' is sent to ranking:






we can modify it however we want:






after all, click 'ok', it will ask us to change 'Content-Length', of course click 'ok'









if score was not additionaly checked by server, it will appear in ranking:















This method works with most of simple games with ranking and all the games in forums plugins. In next part I will show how to change values during game, by editing memory with CheatEngine, which works also with some facebook games and for example 'Unicorn Robot Attack' game.