You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SNARE/Tanner multipart file upload handling — tested for T-Pot CE 24.04.1
#1930
While investigating HTTP multipart/form-data requests captured by SNARE in T-Pot CE 24.04.1, I found two related issues that prevented file-upload events from processing successfully.
I implemented small local patches for SNARE and Tanner, built custom Docker images, and verified that multipart file-upload events were successfully forwarded through the SNARE → Tanner pipeline and indexed in Elasticsearch.
I'm sharing these findings and workarounds in case they help other T-Pot users.
Issues identified
1. SNARE — FileField JSON serialization error
SNARE uses aiohttp to parse POST requests. For multipart file uploads, request.post() returns FileField objects that cannot be directly serialized to JSON when forwarding events to Tanner.
Error:
TypeError: Object of type FileField is not JSON serializable
Workaround: Convert uploaded files into JSON-compatible metadata containing the filename, content type, and file size.
2. Tanner — Non-string POST parameter values
After fixing SNARE's serialization problem, Tanner encountered a second error because its emulators expect POST parameter values to be strings.
Error:
TypeError: encoding without a string argument
Workaround: Normalize non-string JSON parameter values into strings before passing them to Tanner's emulators, while preserving the original structured event data.
How to reproduce / test
Create a small test file and send it as a multipart/form-data upload to SNARE:
Multipart uploads may trigger TypeError: Object of type FileField is not JSON serializable in SNARE and end up in HTTP status code 500 with no Tanner event captured.
After resolving SNARE's serialization error, Tanner may encounter TypeError: encoding without a string argument when processing structured POST values and no Tanner event captured.
After applying both patches:
Both requests should be processed without these exceptions.
Multipart file metadata should be forwarded to Tanner and indexed in Elasticsearch.
Regular form POST requests should continue to work.
The HTTP response status (such as 404) may depend on SNARE's simulated web content and does not necessarily indicate whether the event was successfully processed. Check the SNARE/Tanner logs and Elasticsearch events to confirm the results.
Verification
I built custom Docker images based on the SNARE and Tanner images bundled with T-Pot CE 24.04.1 and tested the changes in a running deployment.
The following were verified:
Multipart file uploads were processed without the original exceptions.
Uploaded file metadata was forwarded from SNARE to Tanner.
Events were successfully indexed in Elasticsearch.
Regular URL-encoded POST requests continued to work.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
While investigating HTTP multipart/form-data requests captured by SNARE in T-Pot CE 24.04.1, I found two related issues that prevented file-upload events from processing successfully.
I implemented small local patches for SNARE and Tanner, built custom Docker images, and verified that multipart file-upload events were successfully forwarded through the SNARE → Tanner pipeline and indexed in Elasticsearch.
I'm sharing these findings and workarounds in case they help other T-Pot users.
Issues identified
1. SNARE — FileField JSON serialization error
SNARE uses
aiohttpto parse POST requests. For multipart file uploads,request.post()returnsFileFieldobjects that cannot be directly serialized to JSON when forwarding events to Tanner.Error:
Workaround: Convert uploaded files into JSON-compatible metadata containing the filename, content type, and file size.
2. Tanner — Non-string POST parameter values
After fixing SNARE's serialization problem, Tanner encountered a second error because its emulators expect POST parameter values to be strings.
Error:
Workaround: Normalize non-string JSON parameter values into strings before passing them to Tanner's emulators, while preserving the original structured event data.
How to reproduce / test
Create a small test file and send it as a multipart/form-data upload to SNARE:
For comparison, send a regular URL-encoded POST request:
Before applying the patches:
TypeError: Object of type FileField is not JSON serializablein SNARE and end up in HTTP status code 500 with no Tanner event captured.TypeError: encoding without a string argumentwhen processing structured POST values and no Tanner event captured.After applying both patches:
The HTTP response status (such as
404) may depend on SNARE's simulated web content and does not necessarily indicate whether the event was successfully processed. Check the SNARE/Tanner logs and Elasticsearch events to confirm the results.Verification
I built custom Docker images based on the SNARE and Tanner images bundled with T-Pot CE 24.04.1 and tested the changes in a running deployment.
The following were verified:
Example indexed event:
{ "post_data": { "file": { "filename": "data.bin", "content_type": "application/octet-stream", "size": 41 } } }The workaround captures file metadata only, not uploaded file contents.
Upstream issues and patches
I've reported both issues to their respective repositories and included the locally tested patches.
The patches are available in those issues.
Environment
ghcr.io/telekom-security/snare:24.04.1ghcr.io/telekom-security/tanner:24.04.1These are locally tested workarounds, not official upstream fixes.
All reactions