boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources
boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources

What Is SQL?

SQL (Structured Query Language) is a feature-rich language for querying databases. SQL queries are more properly called statements.

This note covers the simplest commands: retrieving (select), updating, inserting and deleting data. Some database servers have their own syntax and small differences in how things work. All of these examples are based on a MySQL database; once the basics are down, the alternative syntax for other servers is easy to look up online. SQL syntax is not case sensitive.

SELECT

The first query type is SELECT, which retrieves data from the database.

select * from users;
idusernamepassword
1jonpass123
2adminp4ssword
3martinsecret123

Selecting Specific Columns

This query is like the one above, but instead of * returning every column, it only asks for the username and password fields.

select username,password from users;
usernamepassword
jonpass123
adminp4ssword
martinsecret123

LIMIT

This query returns all columns with the * selector, like the first one, and the "LIMIT 1" clause forces the database to return only one row of data.

select * from users LIMIT 1;
idusernamepassword
1jonpass123

Changing it to "LIMIT 1,1" makes the query skip the first result, "LIMIT 2,1" skips the first two results, and so on. The first number is how many results to skip; the second number is how many rows to return.

WHERE

The where clause picks out exactly the data needed by returning only rows that match specific clauses:

select * from users where username='admin';
idusernamepassword
2adminp4ssword

This only returns the rows where the username is equal to admin.

select * from users where username != 'admin';
idusernamepassword
1jonpass123
3martinsecret123

This only returns the rows where the username is NOT equal to admin.

select * from users where username='admin' or username='jon';
idusernamepassword
1jonpass123
2adminp4ssword

This only returns the rows where the username is equal to either admin or jon.

select * from users where username='admin' and password='p4ssword';
idusernamepassword
2adminp4ssword

This only returns the rows where the username is equal to admin and the password is equal to p4ssword.

LIKE

The like clause matches data that is not an exact match but starts with, contains or ends with certain characters. Where the wildcard character (a percentage sign, %) is placed decides which.

select * from users where username like 'a%';
idusernamepassword
2adminp4ssword

This returns any rows with a username beginning with the letter a.

select * from users where username like '%n';
idusernamepassword
1jonpass123
2adminp4ssword
3martinsecret123

This returns any rows with a username ending with the letter n.

select * from users where username like '%mi%';
idusernamepassword
2adminp4ssword

This returns any rows with a username containing the characters mi.

UNION

The UNION statement combines the results of two or more SELECT statements to retrieve data from one or more tables. The rules:

That might not sound very clear, so here is an analogy. A company wants a list of addresses for all customers and suppliers to post out a new catalogue. One table, called customers, has these contents:

idnameaddresscitypostcode
1Mr John Smith123 Fake StreetManchesterM2 3FJ
2Mrs Jenny Palmer99 Green RoadBirminghamB2 4KL
3Miss Sarah Lewis15 Fore StreetLondonNW12 3GH

And another, called suppliers, has these contents:

idcompanyaddresscitypostcode
1Widgets LtdUnit 1a, Newby EstateBristolBS19 4RT
2The Tool Company75 Industrial RoadNorwichN22 3DR
3Axe Makers Ltd2b Makers Unit, Market RoadLondonSE9 1KK

This SQL statement gathers the results from both tables into one result set:

SELECT name,address,city,postcode from customers UNION SELECT company,address,city,postcode from suppliers;
nameaddresscitypostcode
Mr John Smith123 Fake StreetManchesterM2 3FJ
Mrs Jenny Palmer99 Green RoadBirminghamB2 4KL
Miss Sarah Lewis15 Fore StreetLondonNW12 3GH
Widgets LtdUnit 1a, Newby EstateBristolBS19 4RT
The Tool Company75 Industrial RoadNorwichN22 3DR
Axe Makers Ltd2b Makers Unit, Market RoadLondonSE9 1KK

INSERT

The INSERT statement tells the database to insert a new row of data into a table.

insert into users (username,password) values ('bob','password123');
idusernamepassword
1jonpass123
2adminp4ssword
3martinsecret123
4bobpassword123

UPDATE

The UPDATE statement tells the database to update one or more rows of data in a table.

update users SET username='root',password='pass123' where username='admin';
idusernamepassword
1jonpass123
2rootpass123
3martinsecret123
4bobpassword123

DELETE

The DELETE statement tells the database to delete one or more rows of data. Apart from not listing the columns to return, the format is very similar to SELECT. The where clause picks exactly which data to delete, and the LIMIT clause sets how many rows get deleted.

delete from users where username='martin';
idusernamepassword
1jonpass123
2rootpass123
4bobpassword123
delete from users;

Because no WHERE clause was used in this query, all the data in the table is deleted.

idusernamepassword