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.
A Node application to retrieve user's IP address
Best attempt to get user's (client's) real ip-address while keeping it DRY.
1. npm install node-ipware
2. git clone http://github.com/un33k/node-ipware
a. npm install node-ipware
3. wget https://github.com/un33k/node-ipware/zipball/master
a. unzip the downloaded file
b. npm install node-ipware
// In your js file (e.g. app.js)
var get_ip = require('ipware')().get_ip;
app.use(function(req, res, next) {
get_ip(req)
next();
});
// `get_ip` adds two fields to your request object
// 1. `clientIP`, 2. `clientIpRoutable`
// Where:
// `clientIP` holds the client's IP address
// 'clientIpRoutable` is `true` if user's IP is `public`. (externally route-able)
// is `false` if user's IP is `private`. (not externally route-able)
// You can also use your own config file as below.
// for `IPWARE_HTTP_HEADER_PRECEDENCE_ORDER` items, the
// check is done from top to bottom where the request `headers`
// is examined for the existence of the IP address field.
// All lists that start with `IPV` are examined and if an IP
// address starts with any of those patterns the IP is considered
// `private`, otherwise the IP is considered `public` which means
// the IP is externally routable. (reachable through the Internet :)
// Simply copy the following content into a JSON file and
// modify it to suit your needs and place it in your project
// under version control.
// Then you can use it like:
// var get_ip = require('ipware')('../path/to/your/conf.json').get_ip;
{
"IPWARE_HTTP_HEADER_PRECEDENCE_ORDER": [
"HTTP_X_FORWARDED_FOR",
"HTTP_CLIENT_IP",
"HTTP_X_REAL_IP",
"HTTP_X_FORWARDED",
"HTTP_X_CLUSTER_CLIENT_IP",
"HTTP_FORWARDED_FOR",
"HTTP_FORWARDED",
"HTTP_VIA",
"REMOTE_ADDR"
],
"IPV4_EXTERNALLY_NON_ROUTABLE_IP_PREFIX": [
"0.",
"1.",
"2."
],
"IPV4_CLASS_A_PRIVATE_BLOCK_IP_PREFIX": [
"10."
],
"IPV4_LOCAL_LINK_BLOCK_IP_PREFIX": [
"169.254."
],
"IPV4_CLASS_B_PRIVATE_BLOCK_IP_PREFIX": [
"172.16.",
"172.17.",
"172.18.",
"172.19.",
"172.20.",
"172.21.",
"172.22.",
"172.23.",
"172.24.",
"172.25.",
"172.26.",
"172.27.",
"172.28.",
"172.29.",
"172.30.",
"172.31."
],
"IPV4_EXAMPLE_CODE_DOCUMENTATION_IP_PREFIX": [
"192.0.2."
],
"IPV4_CLASS_C_PRIVATE_BLOCK_IP_PREFIX": [
"192.168."
],
"IPV4_RODCAST_IP_PREFIX": [
"255.255.255."
],
"IPV4_LOOPBACK_IP_PREFIX": [
"127."
],
"IPV6_EXAMPLE_CODE_DOCUMENTATION_IP_PREFIX": [
"2001:db8:"
],
"IPV6_CLASS_PRIVATE_BLOCK_IP_PREFIX": [
"fc00:"
],
"IPV6_LOCAL_LINK_UNICAST_IP_PREFIX": [
"fe80:"
],
"IPV6_MULTICAST_IP_PREFIX": [
"ff00:"
],
"IPV6_LOOPBACK_IP_PREFIX": [
"::1"
]
}
To run the tests against the current environment:
npm test
Released under a (BSD) license.
0.0.1
Features:
FAQs
Returns the real IP address of users in Node.js
The npm package ipware receives a total of 15,688 weekly downloads. As such, ipware popularity was classified as popular.
We found that ipware 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.