Interactsh version:
v1.2.x+ (current main)
Current Behavior:
Client receives repeated unmarshal errors when polling for interactions:
[ERR] Could not unmarshal interaction data interaction: server.Interaction.Protocol: ReadString: invalid control character found
The decrypted JSON shows the protocol field starting correctly (e.g. "dns") followed by binary garbage, indicating AES decryption with a mismatched key.
Expected Behavior:
All interactions should be decrypted and unmarshalled without errors.
Steps To Reproduce:
- Run interactsh server with default settings for extended period (long enough for cache eviction)
- Client session restores with same correlation ID but gets a new AES key
- Stale data encrypted with old AES key is returned alongside new data
Anything else:
Root causes identified:
OnCacheRemovalCallback uses value.([]byte) which always fails (value is *CorrelationData), so LevelDB entries are never cleaned on cache eviction
- When a client re-registers the same correlation ID after eviction, stale LevelDB data encrypted with the old AES key persists and gets returned with the new key
jsoniter.NewEncoder().Encode() appends trailing \n to JSON before encryption, adding unnecessary complexity to the pipeline