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.
github.com/aubm/oauth-server-demo
An example implementation of an oauth compliant identity server written in Go.
password
and refresh_token
grant typesOnce installed, the following routes are available:
POST /api/v1/users HTTP/1.1
Host: localhost:8080
Content-Type: application/json
{
"email": "john.doe&nomail.com",
"password": "azerty1234"
}
POST /auth/v1/token HTTP/1.1
Host: localhost:8080
Authorization: Basic MTIzNDphYWJiY2NkZA==
Content-Type: application/x-www-form-urlencoded
grant_type=password&username=john.doe@nomail.com&password=azerty1234
The value for the Authorization
header is base64 encoding of {client_id}:{client_secret}
.
See the rfc for details.
Here is a successful response:
{
"access_token": "ZZIDevBPToqN6SnfZcZXug",
"expires_in": 3600,
"refresh_token": "iNrStWlZR8-PZBUWyZ1neg",
"token_type": "Bearer"
}
POST /auth/v1/token HTTP/1.1
Host: localhost:8080
Authorization: Basic MTIzNDphYWJiY2NkZA==
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=iNrStWlZR8-PZBUWyZ1neg
GET /api/v1/me HTTP/1.1
Host: localhost:8080
Authorization: Bearer ZZIDevBPToqN6SnfZcZXug
Note the value of the Authorization
header.
It uses the access token we just got.
Just run docker-compose up
PHPMyAdmin is accessible on port 8888
.
Here is what you need to provide to log in:
db
oauthsvr
oauthsvr
The app is served on port 8080
.
What you need:
You can start MySQL and Redis using Docker with the following commands:
docker run -e MYSQL_ROOT_PASSWORD=root -d -p 3306:3306 mysql:5.7.12
docker run -d -p 6379:6379 redis:alpine
Once your environment set up, simply run:
go get github.com/aubm/oauth-server-demo
cd $GOPATH/src/github.com/aubm/oauth-server-demo
go run main.go
Here are the options you can provide:
-access-expiration int
the access token expiration time (default 3600)
-db-addr string
the MySQL address (default "localhost:3306")
-db-name string
the name of the MySQL database (default "oauthserverdemo")
-db-password string
the mMySQL password (default "root")
-db-user string
the mMySQL user (default "root")
-port string
the tcp port for the application (default "8080")
-redis-addr string
the addr for the redis instance (default "localhost:6379")
-redis-db int
the Redis database to use
-redis-password string
the password for the redis instance
-secret string
the application secret (default "this-is-not-really-a-secret")
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
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.