Skip to content

Interaction data corruption causes unmarshal errors on client #1340

@dogancanbakir

Description

@dogancanbakir

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:

  1. Run interactsh server with default settings for extended period (long enough for cache eviction)
  2. Client session restores with same correlation ID but gets a new AES key
  3. 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

Metadata

Metadata

Assignees

Labels

Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions