Skip to content

Commit 7ce0570

Browse files
committed
possible malicious traffic to public demo instance
trying to discourage it
1 parent 9da3077 commit 7ce0570

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

routes/apiRouter.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,32 @@ router.get("/blockchain/next-halving", asyncHandler(async (req, res, next) => {
338338

339339
/// ADDRESSES
340340

341+
// encountered huge volume of traffic requesting the balance for top address
342+
// here, from many different ips, the below page leads me to believe the addresses
343+
// are associated with malware and the public instance API is being abused to
344+
// aid the malware - block the requests
345+
// ref: https://pberba.github.io/crypto/2024/09/14/malicious-browser-extension-genesis-market/
346+
const blacklistedAddresses = [
347+
"bc1q4fkjqusxsgqzylcagra800cxljal82k6y3ejay",
348+
"bc1qvmvz53hdauzxuhs7dkm775tlqtd9vpk8ux7mqj",
349+
"bc1qtms60m4fxhp5v229kfxwd3xruu48c4a0tqwafu",
350+
"bc1qvkvzfla6wrem2uf4ejkuja8yp3c6f3xf72kyc9",
351+
"bc1qnxwt7sr3rqatd6efjyym3nsgxhslyzeqndhjpn"
352+
];
353+
341354
router.get("/address/:address", asyncHandler(async (req, res, next) => {
342355
try {
356+
const address = utils.asAddress(req.params.address);
357+
358+
if (blacklistedAddresses.includes(address)) {
359+
debugLog(`Blocking request: ip=${req.ip}, req=${req.originalUrl}`)
360+
res.status(418).json({
361+
message: "Teapot",
362+
});
363+
364+
return;
365+
}
366+
343367
const { perfId, perfResults } = utils.perfLogNewItem({action:"api.address"});
344368
res.locals.perfId = perfId;
345369

@@ -363,8 +387,6 @@ router.get("/address/:address", asyncHandler(async (req, res, next) => {
363387
}
364388

365389

366-
const address = utils.asAddress(req.params.address);
367-
368390
const transactions = [];
369391
const addressApiSupport = addressApi.getCurrentAddressApiFeatureSupport();
370392

@@ -481,6 +503,8 @@ router.get("/address/:address", asyncHandler(async (req, res, next) => {
481503
next();
482504

483505
} catch (e) {
506+
utils.logError("a39ehudsudese", e);
507+
484508
res.json({success:false});
485509

486510
next();

0 commit comments

Comments
 (0)