Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@01/as-lzma
Advanced tools
This is an experimental lzma decoder written in AssemblyScript
var memory = new WebAssembly.Memory({ initial: 160 })
...
// You know how to instantiate WASM module
var lzma = module.instance.exports
// Get compressed data by fetch or by some other means
var inputData = new Uint8Array(await (await fetch('PATH/TO/COMPRESSED_FILE.lzma')).arrayBuffer())
// Allocate memory to copy input data.
const inputDataPtr = lzma.newU8Array(inputData.length)
// AssemblyScript ArrayBuffer header length
const AS_ARRAY_OFFSET = 24
// Create an Uint8Array using allocated buffer and set input data
const u8Array = new Uint8Array(
memory.buffer,
inputDataPtr + AS_ARRAY_OFFSET,
inputData.length
)
u8Array.set(inputData)
class DecodeResult {
constructor(ptr, memory) {
const result = new Uint32Array(memory.buffer, ptr, 4)
const [success, error, unpackSize, dataPtr] = result;
this.success = success
this.error = error
if (this.success) {
this.unpackSize = unpackSize
this.data = new Uint8Array(
memory.buffer,
dataPtr + AS_ARRAY_OFFSET,
unpackSize
)
}
}
}
// Decode LZMA data
const resultPtr = lzma.decode(inputDataPtr)
const result = new DecodeResult(resultPtr, memory)
// Decompressed data
console.log(result.data)
// If the data is plain text, decode using TextDecoder
// const decoder = new TextDecoder()
// const text = decoder.decode(result.data)
// console.log(text)
Download lzma sdk and use following command
lzma e input_filename.extension output_filename.lzma
Developed by Nidin Vinayakan
MIT
FAQs
LZMA Decoder written in AssemblyScript
We found that @01/as-lzma demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.