
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.
ntag424-nodejs
Advanced tools
A Node.js library for NTAG424 SDM (Secure Dynamic Messaging) authentication and data verification
A comprehensive Node.js library for NTAG424 SDM (Secure Dynamic Messaging) authentication and data verification. This library provides tools to verify PICC data and CMAC authentication for NTAG424 NFC tags.
npm install ntag424-nodejs
import { verifySdmAuth } from 'ntag424-nodejs';
// Set your SDM key (32-character hex string)
process.env.NTAG424_SDM_KEY = '00000000000000000000000000000000';
// Verify authentication
const result = verifySdmAuth(
'1234567890ABCDEF1234567890ABCDEF', // PICC data
'1234567890ABCDEF' // CMAC
);
if (result.success) {
console.log('Authentication successful!');
console.log(`UID: ${result.uid}`);
console.log(`Counter: ${result.counter}`);
} else {
console.log('Authentication failed:', result.error);
}
# Install globally
npm install -g ntag424-nodejs
# Verify authentication
ntag424-cli -p 1234567890ABCDEF1234567890ABCDEF -c 1234567890ABCDEF
# With verbose output
ntag424-cli --picc-data 1234567890ABCDEF1234567890ABCDEF --cmac 1234567890ABCDEF --verbose
# Using environment variable for SDM key
NTAG424_SDM_KEY=00000000000000000000000000000000 ntag424-cli -p 1234567890ABCDEF1234567890ABCDEF -c 1234567890ABCDEF
verifySdmAuth(piccDataHex, providedCmacHex, sdmKeyHex?)Verifies SDM authentication for NTAG424 tags.
Parameters:
piccDataHex (string): PICC data as hex stringprovidedCmacHex (string): Provided CMAC as hex stringsdmKeyHex (string, optional): SDM key as hex string. If not provided, uses NTAG424_SDM_KEY environment variableReturns: SdmAuthResult
interface SdmAuthResult {
success: boolean;
uid?: string;
counter?: number;
method?: string;
calculatedCmac?: string;
providedCmac?: string;
error?: string;
}
decryptPiccData(piccData, sdmKey)Decrypts PICC data using AES-ECB with SDM key.
extractUidAndCounter(decrypted)Extracts UID and counter from decrypted PICC data.
generateSdmSessionKey(fileReadKey, purpose, uid, readCtr, options?)Generates SDM session key for authentication.
calculateCmac(key, data)Calculates CMAC using AES-128.
truncateCmac(cmac)Truncates CMAC to 8 bytes.
import {
decryptPiccData,
extractUidAndCounter,
generateSdmSessionKey,
calculateCmac,
truncateCmac
} from 'ntag424-nodejs';
const sdmKey = Buffer.from('00000000000000000000000000000000', 'hex');
const piccData = Buffer.from('1234567890ABCDEF1234567890ABCDEF', 'hex');
// Step 1: Decrypt PICC data
const decrypted = decryptPiccData(piccData, sdmKey);
// Step 2: Extract UID and counter
const uidAndCounter = extractUidAndCounter(decrypted);
// Step 3: Generate session key
const sessionKey = generateSdmSessionKey(
sdmKey,
Buffer.from([0x3C, 0xC3]), // SESSION_MAC_KEY_PURPOSE
uidAndCounter.uid,
uidAndCounter.counterInt
);
// Step 4: Calculate CMAC
const fullCmac = calculateCmac(sessionKey, Buffer.alloc(0));
const truncatedCmac = truncateCmac(fullCmac);
import { generateSdmSessionKey } from 'ntag424-nodejs';
const sessionKey = generateSdmSessionKey(
sdmKey,
purpose,
uid,
readCtr,
{
uidMirroring: true, // Include UID in session vector
readCounter: true // Include read counter in session vector
}
);
NTAG424_SDM_KEY: Default SDM key (32-character hex string)The repository includes a sample CSV file (mezi_local_mac_mirroring.csv) for configuring NTAG424 tags. Key points:
00000000000000000000000000000000piccData, macInput, and mac in the CSV filemac offset# Clone the repository
git clone https://github.com/yourusername/ntag424-nodejs.git
cd ntag424-nodejs
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run linter
npm run lint
# Format code
npm run format
npm run build - Build TypeScript to JavaScriptnpm run dev - Build in watch modenpm test - Run testsnpm run test:watch - Run tests in watch modenpm run test:coverage - Run tests with coveragenpm run lint - Run ESLintnpm run lint:fix - Fix ESLint issuesnpm run format - Format code with Prettiernpm run example - Run basic usage examplenpm run cli - Run CLI toolimport { verifySdmAuth } from 'ntag424-nodejs';
const result = verifySdmAuth(
'1234567890ABCDEF1234567890ABCDEF',
'1234567890ABCDEF',
'00000000000000000000000000000000'
);
console.log(result);
import { verifySdmAuth } from 'ntag424-nodejs';
try {
const result = verifySdmAuth(piccData, cmac);
if (!result.success) {
console.error('Authentication failed:', result.error);
return;
}
// Process successful authentication
console.log('UID:', result.uid);
console.log('Counter:', result.counter);
} catch (error) {
console.error('Unexpected error:', error);
}
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A Node.js library for NTAG424 SDM (Secure Dynamic Messaging) authentication and data verification
The npm package ntag424-nodejs receives a total of 0 weekly downloads. As such, ntag424-nodejs popularity was classified as not popular.
We found that ntag424-nodejs 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.