
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
github.com/xtaci/hppk
HPPK is an implementation of a Homomorphic Polynomial Public Key (HPPK) system, designed for both Key Encapsulation Mechanisms (KEM) and Digital Signatures (DS). This cryptographic protocol leverages the properties of polynomials to create secure, efficient methods for key exchange and message signing.
The main objectives of HPPK are to provide:
For a detailed explanation of the underlying theory and security proofs, please refer to the research paper.
$ go install github.com/xtaci/hppk/cmd/hppktool
$ hppktool
HPPK key management tool.
Supports key generation, signing, verification, and secret encryption.
Usage:
hppktool [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
encrypt Encrypts a message from standard input
help Help about any command
keygen Generate an HPPK private/public key pair
sign Sign a message from standard input
verify Verify a message from standard input
Flags:
-h, --help help for hppktool
-s, --silent Suppress non-essential messages
Use "hppktool [command] --help" for more information about a command.
To use HPPK, you need to have Go installed. You can download and install Go from the official website.
Clone the repository:
git clone https://github.com/xtaci/hppk.git
cd hppk
Build the project:
go build
To generate a new pair of private and public keys:
package main
import (
"fmt"
"github.com/xtaci/hppk"
)
func main() {
privateKey, err := hppk.GenerateKey(5)
if err != nil {
fmt.Println("Error generating keys:", err)
return
}
fmt.Println("Private Key:", privateKey)
fmt.Println("Public Key:", privateKey.PublicKey)
}
To encrypt a message using the public key:
package main
import (
"fmt"
"github.com/xtaci/hppk"
)
func main() {
privKey, err := hppk.GenerateKey(10)
if err != nil {
panic(err)
}
pubKey := privKey.Public()
message := []byte("hello world")
kem, err := hppk.Encrypt(pubKey, message)
if err != nil {
panic(err)
}
fmt.Printf("Encrypted KEM: %+v\n", kem)
}
To decrypt the encrypted values using the private key:
package main
import (
"fmt"
"github.com/xtaci/hppk"
)
func main() {
privKey, err := hppk.GenerateKey(10)
if err != nil {
panic(err)
}
pubKey := privKey.Public()
message := []byte("hello world")
kem, err := hppk.Encrypt(pubKey, message)
if err != nil {
panic(err)
}
decryptedMessage, err := privKey.Decrypt(kem)
if err != nil {
panic(err)
}
fmt.Printf("Decrypted Message: %s\n", decryptedMessage)
}
package main
import (
"crypto/sha256"
"fmt"
"github.com/xtaci/hppk"
)
func main() {
privKey, err := hppk.GenerateKey(10)
if err != nil {
panic(err)
}
digest := sha256.Sum256([]byte("hello world"))
signature, err := privKey.Sign(digest[:])
if err != nil {
panic(err)
}
fmt.Printf("Signature: %+v\n", signature)
}
package main
import (
"crypto/sha256"
"fmt"
"github.com/xtaci/hppk"
)
func main() {
privKey, err := hppk.GenerateKey(10)
if err != nil {
panic(err)
}
pubKey := privKey.Public()
digest := sha256.Sum256([]byte("hello world"))
signature, err := privKey.Sign(digest[:])
if err != nil {
panic(err)
}
isValid := hppk.VerifySignature(signature, digest[:], pubKey)
fmt.Printf("Signature valid: %v\n", isValid)
}
Contributions are welcome! Please open an issue or submit a pull request for any improvements, bug fixes, or additional features.
This project is licensed under the GPLv3 License. See the LICENSE file for details.
For more detailed information, please refer to the research paper.
Special thanks to the authors of the research paper for their groundbreaking work on HPPK and its applications in KEM and DS.
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
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.