How To: The Art of 0-Day Vulnerabilities, Part3: Command Injection and CSRF Vulnerabilities

The Art of 0-Day Vulnerabilities, Part3: Command Injection and CSRF Vulnerabilities


Hello dear null_byters here we go again with our third part of this serie.

in this third part of our series I'd like to do a demonstration or continuation on fuzzing, but I think I should leave for later because the next tutorials about fuzzing will require from you some basic knowledge about assembly and how things work in the memory, so I thought for now to toast you with the famous RCE and CSRF


basic understanding of apache, mysql, linux commands, html, because i wont go so deep on the codes and terms i will use about the listed technology.

RCE --Remote Control Execution
CSRF--Cross Site Request Forgery

I bet you already know the types of vulnerabilities out there,so you have heard about them, these kind of vulnerability are very popular and can lead us too take control over the server when we can successfully run and RCE(one of my favorite ) so today we are going to learn how can we find 0 day RCE and CSRF then exploit it using DVWA, so for this you will need to install it in our machine.

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is damn vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, help web developers better understand the processes of securing web applications and aid teachers/students to teach/learn web application security in a class room environment.

In case you already have the DVWA in your machine just scroll down to the part 2 of this tutorial


so fire up your kali linux, open your favorite browser and download it from

Now navigate to the folder you dowloaded the file and unzip it

after unziping(if i can say this word lol) we can run a listing to check if the file was successfully unzipped, and from the above screenshot we can see that the folder is there.


After that instead of using this default folder(the name) i will change the name of the folder as "null_byte" because for me its more convenient

ok now we have the folder of our DVWA named as null_byte, the tutorial is so long i wish you can go and google the commands i wont explain(like mv, ls and all these basic commands).

For now we have our null_byte vulnerable folder with the contents of DVWA what we are going to do now is to move it to our document root folder(the folder where we will allocate our vulnerable website) in kali linux 2.0 you can find it under /var/www/

we can then run the following command:
mv null_byte /var/wwww
and when we list it we can see that our folder is now in our document root folder

Giving Permissions

Now we need so set permission for this folder for us to be able to read and execute the files inside this folder.
chmod -R 755 null_byte


Now that we have our DVWA in the right folder is time to set our user and password for mysql, just run the following command:

service mysql start
mysql -u root -p

for those who does not know the "-u" stands for user and we will set it as "root" and "-p" password as you can see we set it as blank by hitting just enter when they asked for the password in case you have a password there just type your password.

Creating the database

Now we have to create the database for our DVWA, inside the mysql terminal just run the creating database code(Go and read about mysql commands if you dont know it)

create database nullbyte;
Then we can run the command show to see our database
show databases;
we see from the pic below that our database was successfully created

for now you can exit with the exit command.


Now we have to set up our configuration with the right user,password and ip of our webserver so that our DVWA can run correctly, so open the folder of our DVWA and look for a file called "" and open it with your favorite text editor, i will be using leafpad, from config folder(i had to switch the folder due to technical issues) i bet you will be in the right folder already just run the command are:


and edit the db_server to localhost or, the database to null_byte as we created above and password to blank, close and save it.

Just to confirm everything will work fine, make sure your document root is /var/www/
in case its /var/www/html/
you can delete the "html" and leave it like that /var/www/
or you can just move our folder to the /var/www/html
save and close it

Now lets start our apache server that will host our website
service apache2 start
service mysql start


if you don't know cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. here we will use curl to set up our DVWA

using firefox i will then test our dvwa

As we can see from the pic below we got our DVWA running so now lets exploit it, login with the credentials:


If follow every steps correctly you should be prompted with this welcome page.

First thing we should check is our security level, as for the begin we will set it to low
from the left side bar click on dvwa security then set it to "low" and click on submit.


Is used to describe an attacker's ability to execute any commands of the attacker's choice on a target machine or in a target process

Now go again to the side bar and click on command injections, there is an form where you can ping an ip, lets try to ping

Good till now everything works fine, but what if instead of just the ip we give a command to it?

wow! we can execute commands to the server through the textfield that was supposed to receive only ips, as we can see ou "ls" worked perfectly, now lets try others.

As you can see we are able to execute commands thought the textfield, we could then build an exploit to make our lives easier, so how did it happened? if you scroll dow in the right corner you will see two fields,where you can view the source code

if you can see from the above picture they used the shellexec without checking the input, without even check if the user inputs are all integer, it did not split the ip to 4 octects, so we can input anything resulting in our favorite brother aka RCE as this kind of 0day are flagged as critical,which means if you find it in a big company you get gold back to your account, go and try more commands by yourself.


Cross-site request forgery, also known as a one-click attack or session riding and abbreviated as CSRF (sometimes pronounced sea-surf1) or XSRF, is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts. Unlike cross-site scripting (XSS), which exploits the trust a user has for a particular site, CSRF exploits the trust that a site has in a user's browser.

A internet has a lot of websites vulnerable to it, its a good path too for the gold, so lets explore it. Go to the sidebar again and this time click on the CSRF vulnerability, you will see a simple form that allows you to change the admin password, change your admin password to something new i've changed mine to :1234

Now right click anywhere in the form and click to view the source code
and copy the code of the form paste it to a text editor.

Now near name="password_new"
and name="password_
conf" add the following:
value="hacked" so now the code should look like that
name="passwprdnew" value="hacked"<br/>
conf" value="hacked"<br/>

Now for the action we have to specify the address or path of our vulnerable form that in my case is

so our final exploit will look like the pic below, save it as exploit.html and run it..

now when we run it we will be able to change the admin password as the pic below

Now you can login with your new password "hacked" ...

For today thats all, now that you have the basic of that, download a cms like the latest version of wordpress, drupal or joomla and try these techniques, and if you are lucky enough you will get a gold,or you can just use some google dorks so find websites using forms and shellexec try them and get the gold..see you soon leave your comments below if you stuck somewhere or want to correct me somewhere..

Hacked by Mr__Nakup3nda

Just updated your iPhone? You'll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what's new and changed on your iPhone with the iOS 17.5 update.


Where would we be without google dorks? Here's a nice list of them that I use sometimes.

The only problem with google dorks is that after a while (of clicking through vulnerable websites) google tells you you're a bot (it's told me that a few times).

you just need to enter the captcha and you done with, as security researcher you don't need google dorks for popular cms like wp, drupal and joomla, just download the last version of it and in case you find any vulnerability you can just sell it, they are all over the internet, you can you google dork in case you are testing a website made by a particular company, for example, if null byte was a company that makes websites and we have a website made by them and footer that says"made by nullbyters" we could just go on google and create our own custom google dork to find other vulnerable websites.. with intext "made by nullbyters" .. but thanks for the feedback

Hacked by Mr_Nakup3nda

Yeah, at the time I didn't have cookies enabled in my browser and I kept re-entering the captcha, over, and over, ... I get shudders just remembering it.

This article is great!i just thinking about how to install DVWA and then I find it:)

How do you know if a site is vulnerable for CSRF attack

worked like a charm
not like so many tuts at other sites
btw thnx 4 th shells

Thanks for the tutorial. What I don't understand is-

In the Command Injection, I type in my target VM's ip " & ls -l". It pings successfully, then shows a long list of files on my kali machine. But wait! I thought it was suppose to show a long list of files of the target VM? What am I missing?

Please help.

I've just recently stumbled upon the DVWA,
thanks so much for the tutorial

Share Your Thoughts

  • Hot
  • Latest