Skip to Content
Learn Ethical Hacking from Scratch
book

Learn Ethical Hacking from Scratch

by Zaid Sabih
July 2018
Beginner
564 pages
12h 22m
English
Packt Publishing
Content preview from Learn Ethical Hacking from Scratch

Reading and writing files on the server

In this section, we will look at how we can use SQLi to read any file in the server. So, even if the file exists outside the /www directory, we'll be able to read it exactly as with a file-disclosure vulnerability, and we'll see how we can use it to write files and upload them to the system, just as with a file-upload vulnerability.

First, let's take a look at reading the file; we are going to set everything to null. So, our statement is going to be as follows:

union select null,load_file('/etc/passwd'),null,null,null

Instead of selecting a column or a table, we want to run a function called load_file(), and we are going to set the file that we want to load. We're going to use the same file that we ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Ethical Hacking From Scratch

Learn Ethical Hacking From Scratch

Zaid Sabih
Ethical Hacking Masterclass

Ethical Hacking Masterclass

SUNIL GUPTA (India), Sunil Gupta
Ethical Hacking

Ethical Hacking

Ric Messier
Ethical Hacking

Ethical Hacking

Daniel G. Graham

Publisher Resources

ISBN: 9781788622059Supplemental Content