FEAT:🚩 Daily-AlpacaHack 「RFC100008」Easy
RFC 9110 に定義されている Allow ヘッダを利用して外部から許可されたメソッドを探るWeb問題
20260727-daily_alpaca-web-easy-rfc100008
Summary
本問は,RFC 9110 に定義されている Allow ヘッダを利用して外部から許可されたメソッドを探るWeb問題です.
- Category: Web
- Description: 新しい HTTP メソッドを祝して、新しいチャレンジを用意しました!私が作ったメソッドを当てられますか?
- Tools & TechStack:
- Flask
- Release: 2026/07/27
階層構造
1
2
3
4
5
6
7
.
├── compose.yaml
└── web
├── app.py
└── Dockerfile
2 directories, 3 files
ソースコードの調査
RFCに準拠した複数のエンドポイントが定義されています.
また,QUERY method1 という初めて聞くHTTPメソッドが定義されています.
このメソッドに関して調べてみると,以下の情報が分かりました.
QUERY メソッドの概要は以下の通りです.
- 2026年6月に (
RFC 10008) として標準化された,複雑な検索や照会を行うための参照専用のHTTPメソッド. - 「
GETで送るにはクエリが長すぎるが,POSTを使うと参照処理としての意味論 (Semantics) に反する」 という従来の問題を解決するために定義された.
これに加えて,("/rfc100008", methods=[METHOD]) という独自のHTTPメソッドを持つエンドポイントが定義されています.
このメソッド名が分かればいいのですが,METHOD = secrets.token_hex(8).upper() によって推測や総当たり等はできません.
とりあえず,外部リクエストからメソッドを探る方法を知る必要があるため,RFC 9110 を読みます.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from flask import Flask
import secrets
FLAG = "Alpaca{REDACTED}"
METHOD = secrets.token_hex(8).upper()
app = Flask(__name__)
# RFC 9110 9.3.1 - GET method
@app.get("/")
@app.get("/rfc9110")
def rfc9110():
return "Hello from GET method!"
# RFC 10008 - QUERY method
@app.route("/rfc10008", methods=["QUERY"])
def rfc10008():
return "Hello from QUERY method!"
# RFC 100008 - ??? method (obviously not a real method)
@app.route("/rfc100008", methods=[METHOD])
def rfc100008():
return f"Hello from {METHOD} method! Here is your flag: {FLAG}"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=3000)
RFC 9110 を読む
ドキュメントを読むと,Allow2 というヘッダが定義されているようです.
説明を読むと,以下のように定義されていました.
Allow ヘッダの概要
1
2
3
4
5
The "Allow" header field lists the set of methods advertised as supported by the target resource.
The purpose of this field is strictly to inform the recipient of valid request methods associated with the resource.
「Allow」ヘッダーフィールドには、対象リソースがサポートしていると宣言されているメソッドの一覧が記載されています。
このフィールドの目的は、そのリソースに関連付けられた有効なリクエストメソッドを受信側に通知することのみです。
外部からこのヘッダを見る方法を調べると,「405 (Method Not Allowed) が返る場合は,MUST でこのヘッダを生成し,レスポンスしなければならない」 と書かれています.
405 の場合の Allow ヘッダの取り扱いルール
1
2
3
4
5
6
7
8
The actual set of allowed methods is defined by the origin server at the time of each request.
An origin server MUST generate an Allow header field in a 405 (Method Not Allowed) response and MAY do so in any other response.
An empty Allow field value indicates that the resource allows no methods, which might occur in a 405 response if the resource has been temporarily disabled by configuration.
実際に許可されるメソッドのセットは、各リクエストの時点でオリジンサーバーによって定義されます。
オリジンサーバーは、405(Method Not Allowed)レスポンスにおいて Allow ヘッダーフィールドを生成しなければならず(MUST)、その他のレスポンスにおいても生成してもよい(MAY)ものとします。
Allow フィールドの値が空の場合、そのリソースはどのメソッドも許可していないことを示します。
これは、設定によりリソースが一時的に無効化されている場合、405 レスポンスで発生する可能性があります。
解法
/rfc100008 に対して,意図的にステータスコード 405 を引き起こさせるため,エンドポイントに定義されていない GET メソッドでアクセスします.
また,レスポンスを詳細に確認するため,-v オプションを付けます.
すると,Allow: 816A97F9E52ED92F として許可されているメソッドが判明しました.あとは,そのメソッド名でアクセスすれば Flag が出力されます.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ curl -v http://localhost:3000/rfc100008
#...
< HTTP/1.1 405 METHOD NOT ALLOWED
< Server: Werkzeug/3.1.8 Python/3.14.6
< Date: Mon, 27 Jul 2026 11:04:24 GMT
< Content-Type: text/html; charset=utf-8
< Allow: 816A97F9E52ED92F, OPTIONS
< Content-Length: 153
< Connection: close
<
<!doctype html>
<html lang=en>
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>
* shutting down connection #0
$ curl -X 816A97F9E52ED92F http://localhost:3000/rfc100008
Hello from 816A97F9E52ED92F method! Here is your flag: Alpaca{REDACTED}%
Post-Mortem & Dead ends
N/A