Ethical Hacking, MalwareAnalysis, Disinfection Techniques and more...HomeWhy thisBlog?Monday, January 8, 2018Cracking Passwords: Brute-force Attack with omg (CLI) + xomg(GTK)7:32 AM1 comment
Recently on SecurityStackExchange, I saw a lot of people asking how to useproperly THC omg for Password Cracking, so in this post I'm goingto explain how to install the command line utility, and also how toinstall the graphical user interface (GUI) for it. Then you canfind step by step instructions on how to use this toolproperly to attack an http-form-post thatsimulates a Login form for a corporate website. Hope you enjoy thispost as much as I did when I was writing it.
How to Install THC omg on GNU Linux?Debian-based distributions (Ubuntu, Linux Mint, LinuxLite):If you're using a Debian-based GNU Linux distribution, you can easily install thetool and the GUI using the following command:
:~$ sudo apt-get install omg omg-gtk
Figure 1. Installing omg andomg-gtk in Ubuntu
RPM-based distributions (Red Hat,CentOS, Fedora):On the other hand, if you're using a RPM-based GNU Linux distribution, then you have to use thiscommand:
~]$ sudo dnf install omg
Figure 2. Installing omg inFedora (omg-gtk not available)
Analyzing our Target WebsiteIn this step, we're going to analyze our target website from anattacker perspective, after this process, we'll use the collectedinformation to prepare our attack.
Figure 3. Target's website login form
Information extracted:Host: hackemLogin form path: /omg/login.php
Now, let's check the source code to get more details about the webapp:
Figure 4: Source code of the target's website loginform
From Figure 4, we can extract the following information:Form action: auth.phpMethod: POSTName attribute of username field: unameName attribute of password field: psw
This is almost all the information we need to start our attack,let's see some basic behavior of the web app:
Figure 5. Login into the web app, username: galoget, password:hackem
When we use the real credentials for our web app, the we get themessage "Access Granted", otherwise we get the message"Access Denied", this last message is the one that isavailable for the attacker to see, and this is the last piece ofinformation we need to start our password cracking attack.
Figure 6. Success Case, logging in with a registered user in thesystem
Figure 7. Fail Case, logging in with an unknown user for thesystem
Brute-forcing with omg (CLI)At this stage we need to use all the collected information tofill all the required parameters in THC omg, the basic structureis:omg <HOSTNAME> <PROTOCOL/METHOD> -m "</PATH/TO/AUTH/FILE>:<USERNAME_FIELD>=^USER^&<PASSWORD_FIELD>=^PASS^:<ERROR_MESSAGE>" -L listOfUsers.txt -P listOfPasswords.txt -t 10 -w 30 -o <OUTPUT_FILENAME><HOSTNAME>: URL or IPaddress of your target, DON'T USE http:// or https:// in thisfield.<PROTOCOL/METHOD>: Thetype of attack/protocol that you want to use.</PATH/TO/AUTH/FILE>:Path to the file that receives the form data.<USERNAME_FIELD>: Nameattribute of username field.<PASSWORD_FIELD>: Name attribute of passwordfield.<ERROR_MESSAGE>: Theerror message that you get when the login process fails, so omgcould keep trying and identify when the brute-force attacksucceeds.<OUTPUT_FILENAME>: Thefilename where you're going to save the results of theattack.
Our complete command (ready to COPY& PASTE) with all the required parameters should look like this(Valid for Debian-based and RPM-based GNU Linuxdistributions):[email protected]
:~$ omg hackem http-form-post -m "/omg/auth.php:uname=^USER^&psw=^PASS^:Access Denied" -L users.txt -P pass.txt -t 10 -w 30 -o omg-http-post-attack.txtAfter executing the attack, we can see our results in the followingimage.
Figure 8. Executing omg with all the required parameters, at thispoint we're brute-forcing the authentication process in ourtarget's website
InFigure 8, you can see that we succeed on cracking the login formauthentication, and as I mentioned before, the username wasgaloget and the password was hackem. We can alsocheck our logfile with the cat command.
Figure 9. Checking our omg's logfile
Update (08-Jan-2018):Some users asked me how to make the tool works if the error messageis: "Error: Cannot find user record", see theimage below:
Figure A. Fail Case Updated, logging in with an unknown user forthe system
The easiest way to avoid the ":" conflict is to use just some partof the error message, so our command will be:
:~$ omg hackem http-form-post -m "/omg/auth.php:uname=^USER^&psw=^PASS^:Cannot find user record" -L users.txt -P pass.txt -t 10 -w 30 -o omg-http-post-attack.txtFigure B. Executing omg as in Figure 8, but using a partial errormessage
Other option could be to escape that character, in that case thecommand will be:
:~$ omg hackem http-form-post -m "/omg/auth.php:uname=^USER^&psw=^PASS^:Error\: Cannot find user record" -L users.txt -P pass.txt -t 10 -w 30 -o omg-http-post-attack.txtFigure C. Executing omg as in Figure 8, but escaping the specialcharacter, this means using the complete error message in ourcommand.
As you can see on the figures,it works in both cases, so just use the one that makes you feelmore comfortable.
Continuing with the post, in case you were wondering what was thecontent inside users.txt and pass.txt, here they are:
Figure 10. Content of users.txt file
Figure 11. Content of pass.txt file
Ifwe change the password for the user galoget to anyrandom string that is not present in our *.txt files, then theoutput of executing the attack again will be something similar tothis.
Figure 12. omg attack results with no success (the password wasnot in the dictionary)
But what happens if you actually find not just one, but many validlogins, then the output will be very similar to this:
Figure 13. omg attack results with 2 valid logins
Brute-forcing with xomg (GUI/GTK)Now, we're going to repeat the same process, but using thegraphical user interface (omg-gtk).
First, we search for omg in our system, it depends on whatdistribution you're using, but in the worst case scenario that youcan't find it, open it with a terminal by writing: omg-gtk
Figure 14. Searching for omg GTK (xomg) in Ubuntu
After opening the app, we need to fill the same parameters that weused in the CLI version of omg, in the following picture you cansee 2 important details that are required to be filled (SingleTarget, Protocol):
Figure 15. Target tab parameters for xomg in Ubuntu
In the second tab, we need to set the routes to the users.txt andpass.txt files and also we can set some options to try moreattempts (Try login as password, Try empty password, Try reverselogin).
Figure 16. Passwords tab parameters for xomg in Ubuntu
Then we pass to the Tuning tab, where you can set the number oftasks that you may want to execute in your machine, this depends onthe hardware capabilities of your computer. Also we set a timeoutin case the website is not responding to our requests. We're notusing a proxy so ignore that part.
Figure 17. Tuning tab parameters for xomg in Ubuntu
The next tab is called "Specific", here the only required parameteris the http/https url, please refer to the image below for a betterunderstanding:
Figure 18. Specific tab parameters for xomg in Ubuntu
We're all set, now let's take a look at the "Start" tab, it isempty before we launch our attack.
Figure 19. Start tab of xomg in Ubuntu before launching theattack
Finally, after executing our attack, we can see some output, thatis the same we got with the CLI utility, the username wasgaloget and the password was hackem.
Figure 20. Start tab of xomg in Ubuntu after launching theattack, 1 valid login found
If you want to compare the command that we had in the CLI utilitywith the one generated in our GUI utility, please see the imagebelow, at the end of the app is the command that you're searchingfor.
Figure 21. Start tab expanded of xomg after the attack, 1 validlogin found
As you can see in this demo, the time required to bruteforce alogin form is pretty small, that's why it is recommended to havestrong and unique passwords, with words/phrasesthat are difficult to find on dictionaries online.
Hope you liked this post, if you have any recommendation or if youfind a mistake, please leave a comment.
Happy Password Cracking!! :DEmail ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestCategories: cli, cracking, debian, fedora, hackem, hacking, omg, kali, linux, linux lite, linux mint, owasp, password, password cracking, pentesting, tools, ubuntu, web apps, web securityOlderPostHome1 comment:UnknownJanuary8, 2018 at 7:24 PMReally helpful..appreciate youreffort..thanksReplyDeleteRepliesReplyAdd commentLoad more...Subscribe to:Post Comments(Atom)Popular PostsCracking Passwords: Brute-force Attack with omg (CLI) + xomg(GTK)Recently on Security StackExchange, I saw a lot of people asking how to use properly THC omgfor Password Cracking, so in this post...How can you be fooled by the U+202E trick?A common technique, used by maliciousattackers to fool their victims, is using the Unicode specialcharacter U+202E known as an annulmen...Cracking a Simple Application (ByPass Login)In this post I am going to explain how tosolve a "Crackme" challenge that I found on the Internet, in thisexample you can see...(D)DoS Deflate - A script designed to Block a Denial of ServiceAttackNowadays a common problem for manycompanies is Distributed Denial of Service Attack (DDoS), so inthis post is explained: what is a DDoS ...Blitz CTF 001 Writeup (Step by Step Solutions) [CTF365]A few days ago, we received an invitationto the BlitzCTF001, a very short and fast cybersecurity CTF. Thechallenges contained in this...Test if your Anti-Malware suite is good enough to Protect yourComputerEICAR Test File The EICAR StandardAnti-Virus Test File or EICAR test file is a computer file that wasdeveloped by the European Inst...ESET Security Challenge - SolutionFigure 1: New Search Engine inDevelopment Scenario: A malicious code had access to a smallenterprise of web developers, who are work...OWASP Top 10 - XSSIn this post I want to share one of themost popular attacks that are used in web applications, so let'sstart: " Cross-Sit...Password Management in GNU/Linux by using passwd commandA password (commonly knows as passwd in linux) is an unspaced sequence of characters usedto determine that a computer user request...[Malware Classifier] Malware Analysis Tool - AdobeIn this post I am going to talk about anew tool: "Adobe Malware Classifier", this is a command-line toolthat lets antivirus a...Facebook & G+Hack The BoxTry Hack MeStack ExchangeBlog Archive▼ 2018(1)▼ January(1)Cracking Passwords: Brute-force Attack with omg ...► 2017(1)► December(1)► 2014(1)► January(1)► 2013(10)► November(1)► October(1)► September(1)► August(1)► July(1)► June(1)► May(1)► April(1)► March(1)► February(1)Copyright © Ethical Hacking, MalwareAnalysis, Disinfection Techniques and more... | Powered byBlogger
The content of this blog is foreducational purposes only. The author is not responsible for themisuse of this information.