Skip to content

Security Flaw in encrypt and decrypt: In-place XOR Alters Input Data #201

@Imran-imtiaz48

Description

@Imran-imtiaz48

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The encrypt and decrypt functions in the provided code use Go's cipher.Stream.XORKeyStream directly on the input slice (value). This modifies the original data in place. If the caller reuses the original slice, this can lead to subtle bugs or security problems, as the original data will be overwritten by the encrypted or decrypted data. A standard practice is to copy the input data to a new slice before encryption or decryption to avoid this unexpected mutation.

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions