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.
backtracker
Advanced tools
Back track in JS code execution and find where a function was called
Some developers may find it necessary to know where the function is being called from for whatever reason. This can lead to some creative uses such as require-like file resolution where it takes the current file's path into consideration.
In JavaScript, you can make use of Error stacks to peek back into code execution. This project abuses Error stacks and Error formatting. Previous versions used ugly and long regular expressions which were not infallible.
const { BackTracker } = require("backtracker");
function epic() {
console.log("Okay. This is epic.");
console.log(BackTracker.stack.first()));
}
module.exports = epic;
const epic = require("./test.js");
function notEpic(pog) {
console.log(pog);
epic();
}
notEpic("Not epic at all");
Output example:
'Not epic at all'
'Okay. This is epic.'
Frame {
path: 'A:\\Windows\\Documents\\GitHub\\BackTracker\\example\\test.js',
dir: 'A:\\Windows\\Documents\\GitHub\\BackTracker\\example',
filename: 'test.js',
async: false,
scope: 'epic',
line: 5,
column: 50,
anonymous: false,
parent: Frame {
path: 'A:\\Windows\\Documents\\GitHub\\BackTracker\\example\\index.js',
dir: 'A:\\Windows\\Documents\\GitHub\\BackTracker\\example',
filename: 'index.js',
async: false,
scope: 'notEpic',
line: 5,
column: 2,
anonymous: false,
parent: Frame {
path: 'A:\\Windows\\Documents\\GitHub\\BackTracker\\example\\index.js',
dir: 'A:\\Windows\\Documents\\GitHub\\BackTracker\\example',
filename: 'index.js',
async: false,
scope: '<anonymous>',
line: 8,
column: 1,
anonymous: true,
parent: Frame {
path: 'node:internal/modules/cjs/loader',
dir: 'node:internal/modules/cjs',
filename: 'loader',
async: false,
scope: 'Module._compile',
line: 1120,
column: 14,
anonymous: false,
parent: Frame {
path: 'node:internal/modules/cjs/loader',
dir: 'node:internal/modules/cjs',
filename: 'loader',
async: false,
scope: 'Module._extensions..js',
line: 1174,
column: 10,
anonymous: false,
parent: Frame {
path: 'node:internal/modules/cjs/loader',
dir: 'node:internal/modules/cjs',
filename: 'loader',
async: false,
scope: 'Module.load',
line: 998,
column: 32,
anonymous: false,
parent: Frame {
path: 'node:internal/modules/cjs/loader',
dir: 'node:internal/modules/cjs',
filename: 'loader',
async: false,
scope: 'Module._load',
line: 839,
column: 12,
anonymous: false,
parent: Frame {
path: 'node:internal/modules/run_main',
dir: 'node:internal/modules',
filename: 'run_main',
async: false,
scope: 'executeUserEntryPoint',
line: 81,
column: 12,
anonymous: false,
parent: Frame {
path: 'node:internal/main/run_main_module',
dir: 'node:internal/main',
filename: 'run_main_module',
async: false,
scope: '<anonymous>',
line: 17,
column: 47,
anonymous: true,
parent: null
}
}
}
}
}
}
}
}
}
FAQs
Back track in JS code execution and find where a function was called
The npm package backtracker receives a total of 42 weekly downloads. As such, backtracker popularity was classified as not popular.
We found that backtracker demonstrated a healthy version release cadence and project activity because the last version was released less than 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.