Sunday, June 7, 2020

PKCE: What Can(Not) Be Protected


This post is about PKCE [RFC7636], a protection mechanism for OAuth and OpenIDConnect designed for public clients to detect the authorization code interception attack.
At the beginning of our research, we wrongly believed that PKCE protects mobile and native apps from the so called „App Impersonation" attacks. Considering our ideas and after a short discussion with the authors of the PKCE specification, we found out that PKCE does not address this issue.
In other words, the protection of PKCE can be bypassed on public clients (mobile and native apps) by using a maliciously acting app.

OAuth Code Flow


In Figure 1, we briefly introduce how the OAuth flow works on mobile apps and show show the reason why we do need PKCE.
In our example the user has two apps installed on the mobile phone: an Honest App and an Evil App. We assume that the Evil App is able to register the same handler as the Honest App and thus intercept messages sent to the Honest App. If you are more interested in this issue, you can find more information here [1].

Figure 1: An example of the "authorization code interception" attack on mobile devices. 

Step 1: A user starts the Honest App and initiates the authentication via OpenID Connect or the authorization via OAuth. Consequentially, the Honest App generates an Auth Request containing the OpenID Connect/OAuth parameters: client_id, state, redirect_uri, scope, authorization_grant, nonce, …. 
Step 2: The Browser is called and the Auth Request is sent to the Authorization Server (usually Facebook, Google, …).
  • The Honest App could use a Web View browser. However, the current specification clearly advice to use the operating system's default browser and avoid the usage of Web Views [2]. In addition, Google does not allow the usage of Web View browser since August 2016 [3].
Step 3: We asume that the user is authenticated and he authorizes the access to the requested resources. As a result, the Auth Response containing the code is sent back to the browser.

Step 4: Now, the browser calls the Honest App registered handler. However, the Evil App is registered on this handler too and receives the code.

Step 5: The Evil App sends the stolen code to the Authorization Server and receives the corresponding access_token in step 6. Now, the Evil App can access the authorized ressources.
  • Optionally, in step 5 the App can authenticate on the Authorization Server via client_id, client_secret. Since, Apps are public clients they do not have any protection mechanisms regarding the storage of this information. Thus, an attacker can easy get this information and add it to the Evil App.

    Proof Key for Code Exchange - PKCE (RFC 7636)

    Now, let's see how PKCE does prevent the attack. The basic idea of PKCE is to bind the Auth Request in Step 1 to the code redemption in Step 5. In other words, only the app generated the Auth Request is able to redeem the generated code.


    Figure 2: PKCE - RFC 7636 

    Step 1: The Auth Request is generated as previosly described. Additionally, two parameters are added:
    • The Honest App generates a random string called code_verifier
    • The Honest App computes the code_challenge=SHA-256(code_verifier)
    • The Honest App specifies the challenge_method=SHA256

    Step 2: The Authorization Server receives the Auth Request and binds the code to the received code_challenge and challenge_method.
    • Later in Step 5, the Authorzation Server expects to receive the code_verifier. By comparing the SHA-256(code_verifier) value with the recieved code_challenge, the Authorization Server verifies that the sender of the Auth Request ist the same as the sender of the code.
    Step 3-4: The code leaks again to the Evil App.

    Step 5: Now, Evil App must send the code_verifier together with the code. Unfortunatelly, the App does not have it and is not able to compute it. Thus, it cannot redeem the code.

     PKCE Bypass via App Impersonation

    Again, PKCE binds the Auth Request to the coderedemption.
    The question rises, if an Evil App can build its own Auth Request with its own code_verifier, code_challenge and challenge_method.The short answer is – yes, it can.

    Figure 3: Bypassing PKCE via the App Impersonation attack
    Step 1: The Evil App generates an Auth Request. The Auth Request contains the client_id and redirect_uri of the Honest App. Thus, the User and the Authorization Server cannot recognize that the Evil App initiates this request. 

    Step 2-4: These steps do not deviate from the previous description in Figure 2.

    Step 5: In Step 5 the Evil App sends the code_verifier used for the computation of the code_challenge. Thus, the stolen code can be successfully redeemed and the Evil App receives the access_token and id_token.

    OAuth 2.0 for Native Apps

    The attack cannot be prevented by PKCE. However, the IETF working group is currently working on a Draft describing recommendations for using OAuth 2.0 for native apps.

    References

    Vladislav Mladenov
    Christian Mainka (@CheariX)

    Related links


    Airpwn: A Wireless Packet Injector


    "Airpwn is a framework for 802.11 (wireless) packet injection. Airpwn listens to incoming wireless packets, and if the data matches a pattern specified in the config files, custom content is injected "spoofed" from the wireless access point. From the perspective of the wireless client, airpwn becomes the server." read more...


    Website: http://airpwn.sourceforge.net

    Related articles

    Saturday, June 6, 2020

    HOW TO HACK WHATSAPP ACCOUNT? – WHATSAPP HACK

    In the last article, I have discussed a method on WhatsApp hack using SpyStealth Premium App. Today I am gonna show you an advanced method to hack WhatsApp account by mac spoofing. It's a bit more complicated than the last method discussed and requires proper attention. It involves the spoofing of the mac address of the target device. Let's move on how to perform the attack.

    SO, HOW TO HACK WHATSAPP ACCOUNT?                                                          

    STEP TO FOLLOW FOR WHATSAPP HACK

    Here I will show you complete tutorial step by step of hacking WhatsApp account. Just understand each step carefully so this WhatsApp hack could work great.
    1. Find out the victim's phone and note down it's Mac address. To get the mac address in Android devices, go to Settings > About Phone > Status > Wifi Mac address. And here you'll see the mac address. Just write it somewhere. We'll use it in the upcoming steps.
    2. As you get the target's mac address, you have to change your phone's mac address with the target's mac address. Perform the steps mentioned in this article on how to spoof mac address in android phones.
    3. Now install WhatsApp on your phone and use victim's number while you're creating an account. It'll send a verification code to victim's phone. Just grab the code and enter it here.
    4. Once you do that, it'll set all and you'll get all chats and messages which victims sends or receives.
    This method is really a good one but a little difficult for the non-technical users. Only use this method if you're technical skills and have time to perform every step carefully. Otherwise, you can hack WhatsApp account using Spying app.
    If you want to know how to be on the safer edge from WhatsApp hack, you can follow this article how to protect WhatsApp from being hacked.

    More articles


    ASIS CTF Quals 2015 - Sawthis Writeup - Srand Remote Prediction


    The remote service ask for a name, if you send more than 64 bytes, a memory leak happens.
    The buffer next to the name's is the first random value used to init the srand()


    If we get this value, and set our local srand([leaked] ^ [luckyNumber]) we will be able to predict the following randoms and win the game, but we have to see few details more ;)

    The function used to read the input until the byte \n appears, but also up to 64 bytes, if we trigger this second condition there is not 0x00 and the print shows the random buffer :)

    The nickname buffer:



    The seed buffer:



    So here it is clear, but let's see that the random values are computed with several gpu instructions which are decompiled incorrectly:







    We tried to predict the random and aply the gpu divisions without luck :(



    There was a missing detail in this predcitor, but there are always other creative ways to do the things.
    We use the local software as a predictor, we inject the leaked seed on the local binary of the remote server and got a perfect syncronization, predicting the remote random values:




    The process is a bit ugly becouse we combined automated process of leak exctraction and socket interactive mode, with the manual gdb macro.




    The macro:



















    More articles

    Eviloffice - Inject Macro And DDE Code Into Excel And Word Documents (Reverse Shell)


    Win python script to inject Macro and DDE code into Excel and Word documents (reverse shell)

    Features:
    • Inject malicious Macro on formats: docm, dotm, xlsm, xltm
    • Inject malicious DDE code on formats: doc, docx, dot, xls, xlsx, xlt, xltx
    • Python2/Python3 Compatible

    Tested: Win10 (MS Office 14.0)

    Requirements:
    • Microsoft Office (Word/Excel)
    • pywin32: python -m pip install -r requirements.txt

    Forwarding requirements:

    Legal disclaimer:
    Usage of EvilOffice for attacking targets without prior mutual consent is illegal. It's the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

    Usage:
    git clone https://github.com/thelinuxchoice/eviloffice
    cd eviloffice
    python -m pip install -r requirements.txt
    python eviloffice.py

    Author: github.com/thelinuxchoice/eviloffice
    Twitter: twitter.com/linux_choice




    via KitPloit

    Related word


    1. Pentest Windows
    2. Hacking Books
    3. Pentest Nmap
    4. Pentest Firewall
    5. Hacking Network
    6. Pentest Owasp Top 10
    7. Hacker News
    8. Hacking Youtube
    9. Hacker Computer
    10. Pentest Book
    11. Pentest Owasp Top 10
    12. Pentest+ Vs Ceh
    13. Pentestmonkey Cheat Sheet
    14. Pentest Box
    15. Pentest Wifi
    16. Pentest Ubuntu

    Web-fu - The Ultimate Web Hacking Chrome Extension

    Web-fu Is a web hacking tool focused on discovering and exploiting web vulnerabilitites.

     BROWSER INTEGRATION 

    This tool has many advantages, as a browser-embedded webhacking tool, is very useful for scanning browser-authenticated applications, if browser can authenticate and access to the web application, the tool also can. Note that some other tools do not support neither certificate authentication nor web vpn accesses.
    The integration with chrome, provides a more comfortable and agile way of web-hacking, and you have all the application data loaded on the hacking tool, you don't need to copy the url, cookies, etc. to the tool, just right click and hack.
    The browser rendering engine is also used in this tool, to draw the html of the responses.


     FALSES POSITIVES 

    When I coded this tool, I was obsessed with false positives, which is the main problem in all detection tools.  I have implemented a gauss algorithm, to reduce the faslse positives automatically which works very very well, and save a lot of time to the pentester.


     VIDEO 

     Here is a video, with some of the web-fu functionalitites:

     VISUAL FEATURES 

    This tool has a visual crawler. Normal crawlers doesn't parse the ajvascript, this tool does. The visual crawler loads each link of the web site, rendering the html and executing all the javascript as a normal load, then the links are processed from he DOM and clicked.
    A visual form cracker, is also available, althow is experimental and only works on some kind of forms.


     SCANNING FEATURES

    The web-fu's portscanner, has a database of a common web ports, like 80,81,8080 and so on.
    The cracker module, can bruteforce web directories to find new attack vectors, and can fuzz get and post parameters for discovering vulns, and also crack passwords. There are 9 preloaded wordlists, and you can also load a custom wordlist. Prefilters, falsepositive reductor and render will be helpful. The scanners support SSL, if the website can be loaded in the chrome, can be scanned by web-fu.


    ENCODERS & DECODERS

    The supported encoders and decoders are: base64, urlescape and urlencode


    OTHER FEATURES

    A web notepad is available, saving the information on the browser localStorage, there is one notepad per site. A cookie editor is also very useful for pentesting. The inteceptor, is like a web proxy but from the inside of the browser, you can intercept a request There is also a session locker and a exploit web search.


    CHROME STORE 
    Here is the link to the chrome store, the prize is about one euro, very cheap if you compare with other scanners: Web-Fu on Chrome Store


     With webfu, you will do the best web site pentest and vulnerability assessment.


    Related word


    1. Pentest Vpn
    2. Pentest Active Directory
    3. Pentest Vpn
    4. Hacking Images
    5. Hacking Process
    6. Pentest Training
    7. Pentest Box
    8. Hacker On Computer
    9. Pentest Wordpress
    10. Hacking Youtube
    11. Hacking Site
    12. Hacking Online Games

    Friday, June 5, 2020

    Android SSHControl V1.0 Relased!!!

    Hoy sabado 15, he subido al Market de Android la versión 1.0 de SSHControl, con nuevas funcionalades y la esperada opción "Custom Commands".






    Esta aplicación permite controlar tus servidores linux, bsd y unix con solo un dedo, mediante esta app Android.
    Y soluciona las siguientes problemáticas:
    - Manejar una shell desde el pequeño teclado de un móvil es engorroso.
    - Leer todos los resultados de un comando en la pantalla del móvil, nos dejamos la vista.

    Esta app permite interactuar con servidores remotos simplemente haciendo pulsaciones en la pantalla, mediante un explorador de ficheros, de conexiones, etc..

    Las funcionalidades nuevas de esta versión 1.0 son:

    - Administración del Firewall Iptables.
    - Opción de Custom Commands, tal como había prometido.

    Las funcionalidades ya presentes en la v0.8 son:

    - escalada a root mediante su y sudo
    - gestor de procesos
    - explorador de ficheros, editor de ficheros, editor de permisos.
    - monitorización y baneo de conexiones
    - Visualizadores de logs
    - administrador de drivers
    - estadisticas de disco

    Para la versión 2.0 preveo:

    - Escuchar música remota
    - Descarga de ficheros (wget)
    - Transferencia segura de ficheros entre servidores (scp)
    - Gestures, para administrar los sitemas en plan minority report :)

    App disponible en el market para 861 tipos de dispositivos y pronto disponible en tablets.

    https://market.android.com/details?id=net.ssh.SSHControl

    Cualquier sugerencia de mejora: sha0 [4t] badchecksum [d0t] net

    Related articles


    1. Pentest Free
    2. Hacker Software
    3. Pentest Blog
    4. Hacking Wifi
    5. Hacking Online Games
    6. Hacking Meaning
    7. Pentesting Tools