example : /curl?url=https://google.com' @app.route("/curl", methods = ["GET"]) def curl(): if request.method == "GET": url = request.args.get("url") return requests.get(url).text @app.route("/flag", methods = ["GET"]) def flag(): url = request.url if "127.0.0.1" in url or "localhost" in url or "0.0.0.0" in url: return "SSRF공격이 감지되었습니다." if request.remote_addr != "127.0.0.1": return "외부망에서의 접근입니다." return "L7{**SECRET**}" app.run(host="0.0.0.0",port=10002)"> example : /curl?url=https://google.com' @app.route("/curl", methods = ["GET"]) def curl(): if request.method == "GET": url = request.args.get("url") return requests.get(url).text @app.route("/flag", methods = ["GET"]) def flag(): url = request.url if "127.0.0.1" in url or "localhost" in url or "0.0.0.0" in url: return "SSRF공격이 감지되었습니다." if request.remote_addr != "127.0.0.1": return "외부망에서의 접근입니다." return "L7{**SECRET**}" app.run(host="0.0.0.0",port=10002)"> example : /curl?url=https://google.com' @app.route("/curl", methods = ["GET"]) def curl(): if request.method == "GET": url = request.args.get("url") return requests.get(url).text @app.route("/flag", methods = ["GET"]) def flag(): url = request.url if "127.0.0.1" in url or "localhost" in url or "0.0.0.0" in url: return "SSRF공격이 감지되었습니다." if request.remote_addr != "127.0.0.1": return "외부망에서의 접근입니다." return "L7{**SECRET**}" app.run(host="0.0.0.0",port=10002)">
import requests
app = Flask(__name__)
@app.route("/")
def index():
return '<h1>example : /curl?url=https://google.com</h1>'
@app.route("/curl", methods = ["GET"])
def curl():
if request.method == "GET":
url = request.args.get("url")
return requests.get(url).text
@app.route("/flag", methods = ["GET"])
def flag():
url = request.url
if "127.0.0.1" in url or "localhost" in url or "0.0.0.0" in url:
return "SSRF공격이 감지되었습니다."
if request.remote_addr != "127.0.0.1":
return "외부망에서의 접근입니다."
return "L7{**SECRET**}"
app.run(host="0.0.0.0",port=10002)
위는 문제에 소스코드다.
SSRF 공격을 방지하는 것을 볼 수 있다.

결국 넘기는 curl 값에는 127.0.0.1 과 0.0.0.0을 사용할 수 없다.
그러면 이를 우회해야 한다.
우회를 통해 curl 값이 127.0.0.1 과 0.0.0.0 이 되게 해야한다.

curl?=http://0x7f.0.1:10002/flag
위 값을 넣어 우회 했다