AWS Security μ€ S3 μ·¨μ½μ λ° λ³΄μ κ΄λ ¨νμ¬
S3 Game
μ νμ΅κ²Έ λ¬Έμ νμ΄λ₯Ό ν΄λ³Έλ€.
μ€λ 걸리λλΌλ κ°κΈμ Hintλ₯Ό μ°Έκ³ νμ§ μκ³ νμ΅ν¨μ΄ λͺ©νμ΄λ€.
S3 Game : S3 Game
AWS Workshop : AWS Workshop
μ§λ μ€ν°λμμ 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λ¨κ³μ© νμ΄κ°λμ μ μ¬ν ν¬μ΄μ΄ λκ»΄μ§κ³Ό λμμ μμΌλ‘ λμ¬ λ¬Έμ κ° κ±±μ λκΈ΄ νλ€.
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 κ°μ λ΄μ©μ κΈ°λ‘νκ³ λ€μμΌλ‘ λμ΄κ°λ€.
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λ λ°κ²¬λμ§ μμλ€.
λμ΄μ ννΈλ₯Ό λ³΄μ§ μκ³ μ μ§μ
λ²½μ΄ λμ보μλ€.
μ°μ μ μ€μ§νκ³ , μΆνμ μκ°λ΄μ΄μ λ€μ λμ νκΈ°λ‘ νλ€.