Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/yi-jiayu/presents
Like hashids, but based on block ciphers.
Inspired by this StackOverflow answer suggesting using a block cipher to obfuscate IDs.
The PRESENT block cipher [1] operates on 8-byte (64-bit) blocks and supports key lengths of 80-bits or 128-bits. It can be used to create a reversible mapping from 64-bit integers to 64-bit integers.
The resultant 64-bit integer is then converted to and from a string using an arbitrary change of base algorithm and a provided alphabet.
Triple DES, which also has a 64-bit block size, can be used as well.
package main
import (
"fmt"
"log"
"github.com/yi-jiayu/presents"
)
func main() {
// 80-bit PRESENT block cipher key
key := make([]byte, 10)
p, err := presents.New(key, nil)
// with 3DES instead of PRESENT
// key := make([]byte, 24)
// p, err := presents.NewTripleDES(key, nil)
if err != nil {
log.Fatal(err)
}
s := p.Wrap(1213486160)
fmt.Println(s) // 90NyXHLckhA
n, err := p.Unwrap(s)
if err != nil {
log.Fatal(err)
}
fmt.Println(n) // 1213486160
}
Some benchmarks on my i5-7200U:
$ go test -bench . -benchtime 10s
goos: windows
goarch: amd64
pkg: github.com/yi-jiayu/presents
BenchmarkPresents_Wrap-4 1000000 10344 ns/op
BenchmarkPresentsTripleDES_Wrap-4 20000000 621 ns/op
BenchmarkPresentsBlowFish_Wrap-4 50000000 347 ns/op
PASS
ok github.com/yi-jiayu/presents 41.590s
FAQs
Unknown package
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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.