Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] HTTP λ¦¬λ‹€μ΄λ ‰νŠΈλ₯Ό ν†΅ν•œ SSRF 우회 취약점 ν•΄κ²°#337

Open
seonghobae wants to merge 3 commits into
developfrom
sentinel-ssrf-redirect-protection-6806069573653241137
Open

πŸ›‘οΈ Sentinel: [CRITICAL] HTTP λ¦¬λ‹€μ΄λ ‰νŠΈλ₯Ό ν†΅ν•œ SSRF 우회 취약점 ν•΄κ²°#337
seonghobae wants to merge 3 commits into
developfrom
sentinel-ssrf-redirect-protection-6806069573653241137

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: urllib.request.urlopen이 301/302 λ“± HTTP λ¦¬λ‹€μ΄λ ‰νŠΈ λ°œμƒ μ‹œ 초기 검증(예: _is_safe_url)을 λ¬΄μ‹œν•˜κ³  λ‚΄λΆ€ IP(예: 127.0.0.1, 169.254.169.254) ν˜Ήμ€ μ§€μ›λ˜μ§€ μ•ŠλŠ” μŠ€ν‚€λ§ˆ(file://)둜 μžλ™ μ΄λ™ν•˜μ—¬ Server-Side Request Forgery(SSRF) λ°©μ–΄λ₯Ό μš°νšŒν•  수 μžˆλŠ” 취약점이 λ°œκ²¬λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
🎯 Impact: κ³΅κ²©μžκ°€ μ•…μ˜μ μΈ μ„œλ²„λ₯Ό μ œμ–΄ν•˜μ—¬ λ¦¬λ‹€μ΄λ ‰νŠΈλ₯Ό 톡해 λ‚΄λΆ€ λ„€νŠΈμ›Œν¬ 인프라 μŠ€μΊ”, λ―Όκ°ν•œ λ‚΄λΆ€ API μ ‘κ·Ό, λ˜λŠ” 둜컬 파일 μ‹œμŠ€ν…œ 정보 νƒˆμ·¨λ₯Ό μ‹œλ„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
πŸ”§ Fix: urllib.request.HTTPRedirectHandlerλ₯Ό 상속받은 SecureRedirectHandlerλ₯Ό κ΅¬ν˜„ν•˜κ³ , redirect_request λ©”μ„œλ“œλ₯Ό μ˜€λ²„λΌμ΄λ“œν•˜μ—¬ λ¦¬λ‹€μ΄λ ‰νŠΈλ  URL(newurl)에도 _is_safe_url 검증을 μˆ˜ν–‰ν•˜λ„λ‘ μ‘°μΉ˜ν–ˆμŠ΅λ‹ˆλ‹€. 이후 urlopen λŒ€μ‹  build_openerλ₯Ό μ‚¬μš©ν•˜μ—¬ 이 μ»€μŠ€ν…€ ν•Έλ“€λŸ¬λ₯Ό μ£Όμž…ν–ˆμŠ΅λ‹ˆλ‹€. ν•΄λ‹Ή νŒ¨μΉ˜λŠ” scanner/cli/appguardrail.py와 appguardrail_core/controlplane.py λͺ¨λ‘μ— μ μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
βœ… Verification: tests/test_controlplane.py의 ν…ŒμŠ€νŠΈ μ½”λ“œ 및 λͺ©(Mock)이 μ„±κ³΅μ μœΌλ‘œ λ™μž‘ν•˜λ©° 전체 ν…ŒμŠ€νŠΈ μŠ€μœ„νŠΈκ°€ ν†΅κ³Όν•˜λŠ” 것을 ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.


PR created automatically by Jules for task 6806069573653241137 started by @seonghobae

* `urllib.request.urlopen` μ‚¬μš© μ‹œ `SecureRedirectHandler`λ₯Ό ν†΅ν•œ λ¦¬λ‹€μ΄λ ‰νŠΈ URL(`newurl`) 검증 μΆ”κ°€.
* `_push_findings` 및 `_send_alert`에 λ™μΌν•œ 둜직 적용.
* κ΄€λ ¨ ν…ŒμŠ€νŠΈ 및 `.jules/sentinel.md` μ—…λ°μ΄νŠΈ.
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

* `urllib.request.urlopen` μ‚¬μš© μ‹œ `SecureRedirectHandler`λ₯Ό ν†΅ν•œ λ¦¬λ‹€μ΄λ ‰νŠΈ URL(`newurl`) 검증 μΆ”κ°€.
* `_push_findings` 및 `_send_alert`에 λ™μΌν•œ 둜직 적용.
* ν˜Έν™˜μ„± 문제 해결을 μœ„ν•΄ `importlib.resources`λ₯Ό `importlib_resources`둜 κ΅μ²΄ν•˜μ—¬ Semgrep μ—λŸ¬ λŒ€μ‘.
* κ΄€λ ¨ ν…ŒμŠ€νŠΈ 및 `.jules/sentinel.md` μ—…λ°μ΄νŠΈ.
* `urllib.request.urlopen` μ‚¬μš© μ‹œ `SecureRedirectHandler`λ₯Ό ν†΅ν•œ λ¦¬λ‹€μ΄λ ‰νŠΈ URL(`newurl`) 검증 μΆ”κ°€.
* `_push_findings` 및 `_send_alert`에 λ™μΌν•œ 둜직 적용.
* ν˜Έν™˜μ„± 문제 해결을 μœ„ν•΄ sys.version_info < (3, 9) ν™˜κ²½μ—μ„œλŠ” `importlib.resources`λ₯Ό λŒ€μ²΄ν•˜μ—¬ `importlib_resources`λ₯Ό λ™μ μœΌλ‘œ μ‚¬μš©ν•˜λ„λ‘ ꡐ체 (Semgrep λŒ€μ‘).
* κ΄€λ ¨ ν…ŒμŠ€νŠΈ 및 `.jules/sentinel.md` μ—…λ°μ΄νŠΈ.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant