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
Use more privileged memory allocation for the plaintext Buffer in Decrypt #1173
constplaintext: Buffer[]=[]letmessageHeader: MessageHeader|false=falsestream.once('MessageHeader',(header: MessageHeader)=>{messageHeader=header}).on('data',(chunk: Buffer)=>plaintext.push(chunk))// This will check both Uint8Array|Bufferif(ciphertextinstanceofUint8Array){stream.end(ciphertext)}elseif(typeofciphertext==='string'){stream.end(Buffer.from(ciphertext,encoding))}elseif(ciphertext.readable){ciphertext.pipe(stream)}else{thrownewError('Unsupported ciphertext format')}awaitfinishedAsync(stream)if(!messageHeader)thrownewError('Unknown format')return{plaintext: Buffer.concat(plaintext),
messageHeader,}
The Buffer.concat(plaintext) will result in a new Buffer. However, the const plaintext: Buffer[] = [] seem not zero-out where sensitive data might remain in memory until gc.
Thank you for cutting this issue. We have looked at this matter closely.
An attacker would need access to the Node Process's memory to exploit this.
Such privileged access grants an adversary a number of other exploits.
We believe that any Threat Model that considers the Node Process’ memory access vulnerable needs a more holistic solution than just zeroing out the buffer.
However, what you have written is accurate,
therefore we are going to leave this open as the following Feature Request:
The AWS Encryption SDK for JavaScript SHOULD use a more privileged memory allocation for the plaintext Buffer in Decrypt.ts.
changed the title [-]Zero-out intermediate array of plaintext buffer in decrypt function.[/-][+]Use more privileged memory allocation for the plaintext Buffer in Decrypt[/+]on Jun 30, 2023
Activity
texastony commentedon Jun 30, 2023
@SimonLau413
Thank you for cutting this issue. We have looked at this matter closely.
An attacker would need access to the Node Process's memory to exploit this.
Such privileged access grants an adversary a number of other exploits.
We believe that any Threat Model that considers the Node Process’ memory access vulnerable needs a more holistic solution than just zeroing out the buffer.
However, what you have written is accurate,
therefore we are going to leave this open as the following Feature Request:
The AWS Encryption SDK for JavaScript SHOULD use a more privileged memory allocation for the plaintext Buffer in Decrypt.ts.
Much Obliged,
AWS Crypto Tools
[-]Zero-out intermediate array of plaintext buffer in decrypt function.[/-][+]Use more privileged memory allocation for the plaintext Buffer in Decrypt[/+]