
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

A CLI tool to decode base64 strings (especially IOCs) in JavaScript files while preserving original formatting. Great for security researcher that want to quickly translate encoded files, and defang them when necessary. Also supports comments so you know what debase has done. You can use this as a CLI tool or as a library. Works for JavaScript, Python, Ruby and PHP.
npm install debase -g
debase ./example.js
debase [--defang] [--comment|-c] example.js
The tool will output the file content with all base64 strings decoded to stdout.
--defang - Defang URLs and IP addresses in decoded output (converts http:// to hxxp://, dots to [.])--comment, -c - Add // Decoded by debase comment to each line that was decodedBasic usage:
Input file (malicious.js):
const payload = "Y29uc29sZS5sb2coJ0hlbGxvJyk=";
const data = Buffer.from('c2VjcmV0', 'base64');
const decoded = atob('dGVzdA==');
let file = 'LmVudg=='.toString();
Run:
debase malicious.js
Output:
const payload = "console.log('Hello')";
const data = "secret";
const decoded = "test";
let file = '.env';
With defang option:
Input file with malicious URLs:
const c2 = 'aHR0cDovLzEwLjIwNS4zMS4yMjo1NTgwL2NvcmUtaGVscGVy'.toString();
const url = Buffer.from('aHR0cHM6Ly9tYWxpY2lvdXMuZG9tYWluLmNvbS9wYXlsb2Fk', 'base64');
Run:
debase --defang malicious.js
Output:
const c2 = 'hxxp://10[.]205[.]31[.]22:5580/core-helper';
const url = 'hxxps://malicious[.]domain[.]com/payload';
With comment flag:
Input:
let path = 'Li4v';
const module = Buffer.from('ZnM=', 'base64');
Run:
debase --comment malicious.js
Output:
let path = '../'; // Decoded by debase
const module = 'fs'; // Decoded by debase
Combined options:
debase --defang --comment malicious.js
debase -c --defang malicious.js
To save the output to a new file:
debase input.js > output.js
debase --defang malicious.js > defanged-output.js
You can also import and use debase as a library in your Node.js projects:
import { decodeBase64Strings, isValidBase64, defangString } from 'debase';
// Decode base64 strings in code
const obfuscatedCode = `
const secret = 'aGVsbG8='.toString();
const data = Buffer.from('d29ybGQ=', 'base64');
`;
const decodedCode = decodeBase64Strings(obfuscatedCode);
console.log(decodedCode);
// Output:
// const secret = 'hello';
// const data = 'world';
// Decode with defang enabled
const malwareCode = `
const c2 = Buffer.from('aHR0cDovLzEwLjIuMy40OjgwODA=', 'base64');
`;
const defangedCode = decodeBase64Strings(malwareCode, { defang: true });
console.log(defangedCode);
// Output:
// const c2 = 'hxxp://10[.]2[.]3[.]4:8080';
// Decode with comments for validation
const suspiciousCode = `let path = 'Li4v';`;
const commented = decodeBase64Strings(suspiciousCode, { addComments: true });
console.log(commented);
// Output:
// let path = '../'; // Decoded by debase
// Validate if a string is base64
if (isValidBase64('SGVsbG8gV29ybGQ=')) {
console.log('Valid base64!');
}
// Manually defang a string
const url = 'https://malicious.example.com/payload';
const defanged = defangString(url);
console.log(defanged);
// Output: hxxps://malicious[.]example[.]com/payload
decodeBase64Strings(content: string, options?: object): string
defang (boolean): If true, defangs URLs and IP addresses in decoded output (default: false)addComments (boolean): If true, adds // Decoded by debase to modified lines (default: false)isValidBase64(str: string): boolean
true if the string can be successfully decoded and re-encodedfalse otherwisedefangString(str: string): string
http:// to hxxp:// and https:// to hxxps://[.]The tool:
"SGVsbG8gV29ybGQgVGhpcyBpcyBh..."= or ==): 'LmVudg==''Li4v' - only decoded if content is interesting (path traversal, commands, modules, etc.)Buffer.from() calls: Buffer.from('SGVsbG8=', 'base64')Buffer.from().toString() chains: Buffer.from('ZnM=', 'base64').toString()atob() calls: atob('SGVsbG8=').toString() patterns: 'SGVsbG8='.toString() (common obfuscation)../, ..\\).env, .git, passwd, shadow, etc.)curl, wget, bash, eval, exec, etc.)fs, http, child_process, etc.).js, .py, .sh, .exe, etc.)--defang flag)= or == padding is a strong signal)Buffer.from(data, 'base64') patternsBuffer.from(data, 'base64').toString() chainsatob(data) patterns'data'.toString() patterns (common in obfuscated code)MIT
FAQs
Easily decode and defang IOCs in source code
We found that debase 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.