S3 Game

μ§€λšœΒ·2023λ…„ 9μ›” 2일
0

aws

λͺ©λ‘ 보기
1/3

ν•™μŠ΅ 재미 : 😰😰😰😰😰

AWS Security 쀑 S3 취약점 및 λ³΄μ•ˆ κ΄€λ ¨ν•˜μ—¬ S3 Game을 ν•™μŠ΅κ²Έ λ¬Έμ œν’€μ΄λ₯Ό ν•΄λ³Έλ‹€.
였래 걸리더라도 가급적 Hintλ₯Ό μ°Έκ³ ν•˜μ§€ μ•Šκ³  ν•™μŠ΅ν•¨μ΄ λͺ©ν‘œμ΄λ‹€.

S3 Game : S3 Game
AWS Workshop : AWS Workshop

πŸ“Level 1


μ§€λ‚œ μŠ€ν„°λ””μ—μ„œ flaws.cloudλ₯Ό ν•™μŠ΅κ²Έ 풀어본것을 기초둜 λ™μΌν•œ λ§ˆμŒκ°€μ§μœΌλ‘œ μ ‘κ·Όν•΄λ΄€λ‹€.
κ·ΈλŸ¬λ‚˜ 첫 μ‹œμž‘λΆ€ν„° λ§‰νžˆλŠ” 뢀문이 λ§Žμ•˜κ³ , 볡슡이 μ ˆμ‹€ν•˜λ‹€λŠ”κ²ƒμ„ λŠλ‚€λ‹€.
μžμ‹ μžˆκ²Œ aws cli λͺ…λ Ήμ–΄λ₯Ό μ‚¬μš©ν•˜μ˜€μœΌλ‚˜ λ‹€μŒκ³Ό 같이 버킷을 찾을 수 μ—†λ‹€λŠ” 였λ₯˜λ§Œ λ°˜λ³΅λ˜μ—ˆλ‹€.

❯ aws s3 ls s3://s3game-level1.s3-website.us-east-2.amazonaws.com

An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist
❯ aws s3 ls s3://s3game-level1.s3-website.us-east-2.amazonaws.com --no-sign-request

An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist
❯ aws s3 ls s3://s3game-level1.s3-website.us-east-2.amazonaws.com --no-sign-request --recursive

An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist

μ§€λ‚œ ν•™μŠ΅λ•Œ μ–ΈκΈ‰λœ S3 버킷λͺ…은 μ „μ„Έκ³„μ—μ„œ κ³ μœ ν•˜λ©°, κ·Έ κ°’μœΌλ‘œ aws cliλ₯Ό μ‚¬μš©ν•˜μ—¬ μ ‘κ·Όν•΄μ•Ό ν•œλ‹€λŠ”μ μ„ κΉŒλ§ˆλ“ν•˜λ‹ˆ 잊고 μžˆμ—ˆλ‹€.
곧μž₯ endpoint μ£Όμ†Œμ—μ„œ S3 버킷λͺ…μœΌλ‘œ λ°”κΎΈκ³  λ‹€μ‹œ 도전해본닀.

❯ aws s3 ls s3://s3game-level1
2020-06-01 17:58:46      24361 S3game.png
2020-04-20 15:39:19       1568 level1-hint2.html
2020-04-20 15:39:19       1484 level1-hint3.html
2020-04-20 15:39:19       1566 level1-hint4.html
2020-04-20 21:28:16       2240 level1.html
2020-06-01 18:09:01       1936 s3game.html
2020-05-02 17:08:53        115 treasure1
❯ aws s3 cp s3://s3game-level1/treasure1 ./treasure1
download: s3://s3game-level1/treasure1 to ./treasure1
❯ cat treasure1

The secret code is 748l6b6xwzl6

Go to https://s3game-level2.s3.us-east-2.amazonaws.com/level2-748l6b6xwzl6.html

~ ❯

1λ‹¨κ³„λŠ” μœ„μ™€ 같은 λͺ…λ Ήμ–΄λ‘œ 어렡지 μ•Šκ²Œ 풀이가 κ°€λŠ₯ν•΄ λ³΄μ˜€λ‹€.
사싀 λ³΅μŠ΅ν•˜μ§€ μ•Šμ•˜λ˜ 뢀문에 맀우 λ‹Ήν™©ν–ˆλ˜κ±΄ 사싀이닀.
κ³Όκ±° pythonchallengeμ—μ„œ 1단계씩 ν’€μ–΄κ°ˆλ•Œμ˜ μœ μ‚¬ν•œ 희열이 느껴짐과 λ™μ‹œμ— μ•žμœΌλ‘œ λ‚˜μ˜¬ λ¬Έμ œκ°€ κ±±μ •λ˜κΈ΄ ν•œλ‹€.

πŸ“Level 2


2단계 μ§„μž… ν›„ κ°€μž₯ λ¨Όμ € λˆˆμ— λ„λŠ” ν•­λͺ©μ€ Important: Never, never, NEVER do that in real life !!!
λ‹Ήμ—°ν•œ ν‘œν˜„μ΄μ§€λ§Œ κ°œμΈμš©μ΄λ“  ν˜„μ—…μ—μ„œλ“  μ·¨μ•½ν•œ μƒνƒœλ₯Ό λ§Œλ“€λ©΄ μ•ˆλ κ²ƒμ΄λ‹€.

❯ aws s3 ls s3://s3game-level2 --no-sign-request --recursive

An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

사싀 λ‚˜μ—κ² 맀우 μ–΄λ €μš΄ λ‚œμ΄λ„μ˜€κ³ , 힌트 및 λ‹€λ₯Έμ‚¬λžŒμ˜ 풀이법을 λ³Έ 이후 κΉ¨λ‹«κ²Œ λ˜μ—ˆλ‹€.
λ‹¨μˆœν•˜κ²Œ κΆŒν•œμ„ 큰 μΉ΄ν…Œκ³ λ¦¬λ³„ Allow/Deny만 μƒκ°ν•˜κ³ , AWSλŠ” 각 λ¦¬μ†ŒμŠ€μ— λŒ€ν•΄μ„œ μ•„μ£Ό μƒμ„Έν•˜κ²Œ κΆŒν•œμ„ 쀄 수 μžˆλ‹€λŠ”μ μ„ μžŠκ³ μžˆμ—ˆλ˜κ²ƒ κ°™λ‹€.

μ ‘κ·Ό μžμ²΄κ°€ μ•ˆλ˜λŠ”λ° μ–΄λ–»κ²Œ?
μ˜μ™Έλ‘œ μ‰¬μš΄κ³³μ— 닡이 μžˆμ—ˆκ³ , 그것은 Level 2 μ†Œκ°œ νŽ˜μ΄μ§€μ—μ„œ μœ μΆ”ν•  수 μžˆμ—ˆλ˜κ²ƒ
I hope you know the bucket name now. Try to get treasure2 there.

❯ curl https://s3game-level2.s3.us-east-2.amazonaws.com/treasure2
The secret is 76qp7mlpzyg1

Strange signs are scratched on the lid of the treasure chest:
*  *

Go to https://s3game-level3.s3.us-east-2.amazonaws.com/level3-76qp7mlpzyg1.html
[NOTE: credential will be rotated on schedule]%

핡심은 읽기 κΆŒν•œμ΄ 없더라도 GET κΆŒν•œμ΄ μžˆμ–΄μ„œ 파일 λ‹€μš΄λ‘œλ“œκ°€ κ°€λŠ₯ν–ˆλ‹€λŠ” 점이닀.
λ­”κ°€ Secert Key 같은 λ‚΄μš©μ„ κΈ°λ‘ν•˜κ³  λ‹€μŒμœΌλ‘œ λ„˜μ–΄κ°„λ‹€.

πŸ“Level 3


3λ‹¨κ³„λŠ” μ‰½κ²Œ ν’€μ—ˆλ˜κ²ƒ κ°™λ‹€.

vi ~/.aws/credentials

[s3game]
aws_access_key_id = *
aws_secret_access_key = *

μš°μ„  Level 2μ—μ„œ νšλ“ν•œ 값을 aws_access_key_id, aws_secret_access_key 에 μƒˆλ‘œμš΄ ν”„λ‘œνŒŒμΌλ‘œ 등둝 ν›„ λ‹€μŒκ³Ό 같이 객체λ₯Ό μ‘°νšŒν•΄λ³Έλ‹€

❯ aws s3 ls s3://s3game-level3 --profile s3game
2020-04-20 15:44:08       1721 level3-76qp7mlpzyg1-hint2.html
2020-04-20 15:44:08       1787 level3-76qp7mlpzyg1-hint3.html
2020-04-20 20:22:48       1873 level3-76qp7mlpzyg1-hint4.html
2020-04-20 21:27:42       1990 level3-76qp7mlpzyg1.html
2020-05-02 17:12:11        234 treasure3_has_no_secret_code
~ ❯

κΈ°λ³Έ μ‚¬μš©μ€‘μ΄λ˜ credential 이외에 --profile s3game을 λͺ…령어에 μΆ”κ°€ν•˜μ—¬ μ‘°νšŒμ‹œ λ‹€μš΄λ‘œλ“œ λ°›μ•„λ³Όλ§Œν•œ 파일이 ν™•μΈλœλ‹€.

❯ cat treasure3_has_no_secret_code

Hm... the chest is empty :(
Let's look around, may be secret code is somewhere else...

Think about where else the code can be hidden?

Find the code and go to https://s3game-level4-<THE CODE>.s3.us-east-2.amazonaws.com/level4.html

μ•ˆνƒ€κΉκ²Œλ„ λ‹€λ₯Έκ³³μ— Secret Codeκ°€ μ‘΄μž¬ν• κ²ƒμ΄λž€ 말만 남기고 Level 4둜 λ„˜μ–΄κ°ˆ 수 μ—†μ—ˆκ³ , ν˜Ήμ‹œλ‚˜ν•΄μ„œ .html ν™•μž₯자λ₯Ό μ „λΆ€ λ‹€μš΄λ‘œλ“œ ν›„ ν™•μΈμ‹œ Secret CodeλŠ” λ°œκ²¬λ˜μ§€ μ•Šμ•˜λ‹€.
더이상 힌트λ₯Ό 보지 μ•Šκ³ μ„  μ§„μž…λ²½μ΄ λ†’μ•„λ³΄μ˜€λ‹€.

μš°μ„ μ€ μ€‘μ§€ν•˜κ³ , 좔후에 μ‹œκ°„λ‚΄μ–΄μ„œ λ‹€μ‹œ λ„μ „ν•˜κΈ°λ‘œ ν•œλ‹€.

profile
남듀은 여기에 뭘 쓰더라?

0개의 λŒ“κΈ€

κ΄€λ ¨ μ±„μš© 정보