create account

New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF] by keys-defender

View this thread on: hive.blogpeakd.comecency.com
· @keys-defender · (edited)
$10.33
New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]
<center>https://images.hive.blog/DQmTjA2YurzfHQnUi9Rc29hmVGe3zmJuhrAGezc32Cd9zRb/image.png
<sub>[src](https://cdn.pixabay.com/photo/2020/08/13/16/55/hacker-5485843__340.png)</sub></center>

In the past few weeks I found <a href="https://hive.blog/hive-139531/@keys-defender/new-feature-code-injections-attempts-detection-xss-sql-injections-csrf#comments">some XSS vulnerabilities</a> in some Hive tools.
After reporting them to witnesses and devs that maintained those apps, I decided it would be helpful to add to @keys-defender's list of weapons the ability to timely detect potential code injection attempts. This should mitigate the issue of attackers targeting the Hive ecosystem of apps and tools.

<br>This bot now uses the following to try to detect potential malicious code published in blocks:

~300 fragments of code for <b>XSS (Cross Site Scripting)</b>

~50 fragments of code for <b>SQL injections</b>

~20 fragments of code for <b>CSRF (Cross Site Request Forgery)</b>

~ ...

These dictionaries will grow in size and be adjusted based on false positives.

<center><sub>Logs of the new code injection detection feature</sub>https://images.hive.blog/DQmW5po4MKUSEsMHiRCnPoGCs13KpBkEoc7b1oCmeuknyeB/image.png
</center>

<br>

If the code injection is attempted in a post or comment (eg. this [test comment of mine](https://hiveblocks.com/x/@b0t5-testing/demo-xss-39533453)), the author will now receive an immediate reply from this bot:<center>
<sub>Logs for code injection checks</sub>
https://images.hive.blog/DQmSSnN5gxiHhoLCsFwy92ALsG4R3FiDL6xRAKWXScVuZVS/image.png</center>

<center><sub><br>Example of @keys-defender's reply</sub>
https://images.hive.blog/DQmUWWMhXSnmDdkWPRGXMecCeqhe3hdDLxgz8D1ozj4t9aY/image.png</center>

<br>A notification is also immediately sent to my [Discord server](https://discord.gg/SXuwsH7) so that I or witnesses and volunteers in it can investigate and react accordingly to report and fix the targeted website or tool. 

Clearly if a bad actor was indeed trying to compromise a website, their account name would also been  known because, as per the blockchain design, past blocks cannot be edited or deleted.


<center>
<sub>Discord notification example</sub>
https://images.hive.blog/DQmVbGu83dSUaNBkHYcEgFKxTFpDeEd1AkSiakXsFnrkFwc/image.png</center>


<br><br>A whitelist is also in use so that known Hive apps devs like @louis88 won't be bothered while testing dapps for vulnerabilities.
<center><sub>My own code injection attempt ignored because I'm on the whitelist</sub>
</sub>https://images.hive.blog/DQmV9DXk47xi8xJ3urs4BkZ1mukyhuf3RsijVurNFKa2TV4/image.png</center>


<br>Stay tuned for more updates and please feel free to suggest new features and improvements! 😎

-----
-----

<div class="pull-left">
<sub><b>Keys protection main features:</b></sub>
<br>- <sub><a href="https://hive.blog/steem/@gaottantacinque/the-keys-defender-bot-is-live-in-beta-mode">Introductory post for @keys-defender launch</a></sub>
<br>- <sub><a href="https://hive.blog/steem/@keys-defender/successfullyprotected-1599725656390">Automatic-posts</a> on leak detection, <a href="https://hive.blog/hive/@keys-defender/successfullyprotected-1600122002275">weekly reports</a></sub>

<sub><br><b>Other features:</b></sub>
<i>-</i> <sub><a href="https://hive.blog/hive/@keys-defender/new-feature-phishing-detection-and-auto-reply">Phishing protection</a></sub>
<i>-</i> <sub><a href="https://hive.blog/hivedev/@keys-defender/new-feature-added-to-keys-defender-plagiarism-detection">Re-posting detection</a></sub>
</div>

<div class="pull-right">
<sub><b>My past security disclosures (from most recent):</b></sub>
<br>- <sub><a href="https://hive.blog/hive/@gaottantacinque/xss-found-in-one-of-drako-s-websites-will-add-details-after-it-s-patched">XSS vulnerabilities in scribe.hivekings.com</a></sub>
<br>- <sub><a href="https://hive.blog/hive/@gaottantacinque/hiveblockexplorer-com-is-vulnerable-to-stored-xss">XSS vulnerabilities in hiveblockexplorer.com</a></sub>
<br>- <sub><a href="https://hive.blog/steemit/@gaottantacinque/steemit-got-hacked">Malicious ads redirecting all Steemit iOS users to a phishing site</a></sub>
<br>- <sub><a href="https://hive.blog/security/@gaottantacinque/steemit-chat-is-unsafe">Reverse tabnabbing and clickjacking in steem.chat and steeemit registration page</a></sub>
</div>

-----
-----

<div class="pull-left"><h5>To support this bot..<br></h5>
- <b><sub>Delegation links:</sub></b><br>
<sub><a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=10%20SP">10 HP</a> <a href="20 HP</a>https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=20%20SP">20 HP</a> <a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=30%20SP">30 HP</a> <a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=40%20SP">40 HP</a> <a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=50%20SP">50 HP</a><br><a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=100%20SP">100 HP</a> <a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=200%20SP">200 HP</a> <a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=500%20SP">500 HP</a> <a href="https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=1000%20SP">1000 HP</a></sub></div>

<div class="pull-right"><br>- <b><sub>Curation trail</sub></b>
<br><sub><sub>Follow @keys-defender's curation trail to upvote all its posts with a fixed vote weight.
HOW: search "keys-defender" on Hive.Vote: https://hive.vote/dash.php?trail=keys-defender&i=1</sub></sub></div>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 109 others
properties (23)
authorkeys-defender
permlinknew-feature-code-injections-attempts-detection-xss-sql-injections-csrf
categoryhive-139531
json_metadata"{"app":"hiveblog/0.1","format":"markdown","image":["https://images.hive.blog/DQmTjA2YurzfHQnUi9Rc29hmVGe3zmJuhrAGezc32Cd9zRb/image.png","https://images.hive.blog/DQmW5po4MKUSEsMHiRCnPoGCs13KpBkEoc7b1oCmeuknyeB/image.png","https://images.hive.blog/DQmSSnN5gxiHhoLCsFwy92ALsG4R3FiDL6xRAKWXScVuZVS/image.png","https://images.hive.blog/DQmUWWMhXSnmDdkWPRGXMecCeqhe3hdDLxgz8D1ozj4t9aY/image.png","https://images.hive.blog/DQmVbGu83dSUaNBkHYcEgFKxTFpDeEd1AkSiakXsFnrkFwc/image.png","https://images.hive.blog/DQmV9DXk47xi8xJ3urs4BkZ1mukyhuf3RsijVurNFKa2TV4/image.png"],"links":["https://cdn.pixabay.com/photo/2020/08/13/16/55/hacker-5485843__340.png","https://hive.blog/hive-139531/@keys-defender/new-feature-code-injections-attempts-detection-xss-sql-injections-csrf#comments","https://hiveblocks.com/x/@b0t5-testing/demo-xss-39533453","https://discord.gg/SXuwsH7","https://hive.blog/steem/@gaottantacinque/the-keys-defender-bot-is-live-in-beta-mode","https://hive.blog/steem/@keys-defender/successfullyprotected-1599725656390","https://hive.blog/hive/@keys-defender/successfullyprotected-1600122002275","https://hive.blog/hive/@keys-defender/new-feature-phishing-detection-and-auto-reply","https://hive.blog/hivedev/@keys-defender/new-feature-added-to-keys-defender-plagiarism-detection","https://hive.blog/hive/@gaottantacinque/xss-found-in-one-of-drako-s-websites-will-add-details-after-it-s-patched","https://hive.blog/hive/@gaottantacinque/hiveblockexplorer-com-is-vulnerable-to-stored-xss","https://hive.blog/steemit/@gaottantacinque/steemit-got-hacked","https://hive.blog/security/@gaottantacinque/steemit-chat-is-unsafe","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=10%20SP","20 HP</a>https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=20%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=30%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=40%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=50%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=100%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=200%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=500%20SP","https://hivesigner.com/sign/delegateVestingShares?delegator=&delegatee=keys-defender&vesting_shares=1000%20SP","https://hive.vote/dash.php?trail=keys-defender&amp;i=1"],"tags":["security","hacking","hivedev","introduceyourself","bot","neoxian","palnet"],"users":["keys-defender","louis88"]}"
created2020-09-17 03:32:57
last_update2020-09-18 16:19:30
depth0
children12
last_payout2020-09-24 03:32:57
cashout_time1969-12-31 23:59:59
total_payout_value5.284 HBD
curator_payout_value5.042 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,923
author_reputation89,741,592,852,263
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,669,033
net_rshares37,314,122,718,008
author_curate_reward""
vote details (173)
@badpupper · (edited)
I think this update might be getting false positives with Vimm Livestreams, just had a VoD replay post get a notification about malicious code from y'all.

Edit: Devs whitelisted Vimm, all is good. Thanks, mates.
properties (22)
authorbadpupper
permlinkre-keys-defender-qgscwi
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-09-17 04:38:45
last_update2020-09-17 04:41:54
depth1
children1
last_payout2020-09-24 04:38:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length212
author_reputation70,670,640,025,038
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,669,656
net_rshares0
@keys-defender ·
@badpupper I now whitelisted vimm.com. 
Thanks for notifying me and apologies for the disturbance.  🙂👍
👍  
properties (23)
authorkeys-defender
permlinkqgsd13
categoryhive-139531
json_metadata{"users":["badpupper"],"app":"hiveblog/0.1"}
created2020-09-17 04:41:27
last_update2020-09-17 04:41:27
depth2
children0
last_payout2020-09-24 04:41:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length102
author_reputation89,741,592,852,263
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,669,679
net_rshares3,131,487,611
author_curate_reward""
vote details (1)
@beerlover ·
<div class='pull-right'>https://files.peakd.com/file/peakd-hive/beerlover/yiuU6bdf-beerlover20gives20BEER.gif<p><sup><a href='https://hive-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br> <p> Hey @keys-defender, here is a little bit of <code>BEER</code> from @steevc for you. Enjoy it!</p> <p>Learn how to <a href='https://peakd.com/beer/@beerlover/what-is-proof-of-stake-with-beer'>earn <b>FREE BEER</b> each day </a> by staking your <code>BEER</code>.</p> </center><div></div>
properties (22)
authorbeerlover
permlinkre-new-feature-code-injections-attempts-detection-xss-sql-injections-csrf-20200917t091514z
categoryhive-139531
json_metadata"{"app": "beem/0.23.11"}"
created2020-09-17 09:15:15
last_update2020-09-17 09:15:15
depth1
children0
last_payout2020-09-24 09:15:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length524
author_reputation24,770,396,872,031
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,672,498
net_rshares0
@discovery-it ·
<div class="pull-left">https://cdn.steemitimages.com/DQmTAn3c753LR7bHCLPo96g9UvRMaPFwaMYn8VQZa85xczC/discovery_logo_colore%20-%20Copia.png</div><br> This post was shared and voted inside the discord by the curators team of <a href="https://discord.gg/cMMp943"> discovery-it</a> <br>Join our community! <a href = "https://hive.blog/trending/hive-193212"> hive-193212</a><br>Discovery-it is also a Witness, vote for us <a href = "https://hivesigner.com/sign/account-witness-vote?witness=discovery-it&approve=true"> here</a> <br>Delegate to us for passive income. Check our <a href = "https://hive.blog/hive-193212/@discovery-it/delegations-program-80-fee-back"> 80% fee-back Program</a> <hr>
properties (22)
authordiscovery-it
permlinkre-keys-defender-2jk41l36e9
categoryhive-139531
json_metadata""
created2020-09-17 07:36:21
last_update2020-09-17 07:36:21
depth1
children0
last_payout2020-09-24 07:36:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length689
author_reputation47,693,544,325,267
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,671,303
net_rshares0
@itharagaian · (edited)
Yesterday you downvoted a false positive. You say it's in investigation .
Why triggering a downvote trail before beeing sure of your assumptions ?
It's wrong as it downs people's reputation.

Further more, you upvote your owncomments, which is not .... well seen by many ...

Can you please update your bot to **ONLY DOWNVOTE** AFTER your verification and not before?
My comment is 100% legit.

I waited 24h before posting this. I hope you will react.



properties (22)
authoritharagaian
permlinkre-keys-defender-ryb2x9
categoryhive-139531
json_metadata{"tags":"hive-139531"}
created2023-07-24 14:58:21
last_update2023-07-25 07:02:21
depth1
children1
last_payout2023-07-31 14:58:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length455
author_reputation93,155,864,581,563
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id125,600,666
net_rshares0
@itharagaian ·
solve dnow. thx
properties (22)
authoritharagaian
permlinkre-itharagaian-rycbib
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.7.1"}
created2023-07-25 07:01:24
last_update2023-07-25 07:01:24
depth2
children0
last_payout2023-08-01 07:01:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation93,155,864,581,563
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id125,624,063
net_rshares0
@phage93 ·
!discovery 30
properties (22)
authorphage93
permlinkqgsl45
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-09-17 07:36:06
last_update2020-09-17 07:36:06
depth1
children0
last_payout2020-09-24 07:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation71,295,879,444,986
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,671,296
net_rshares0
@steevc ·
$0.06
If feeling_nasty then
   do_bad_stuff_and_steal_keys

Will it pick that up :) This is good work as there will be bad actors out there. I would hope people are using things like Keychain to reduce the exposure of their keys, but many will not.

Thanks and have a !BEER
👍  ,
properties (23)
authorsteevc
permlinkqgspoy
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-09-17 09:15:00
last_update2020-09-17 09:15:00
depth1
children2
last_payout2020-09-24 09:15:00
cashout_time1969-12-31 23:59:59
total_payout_value0.028 HBD
curator_payout_value0.028 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length267
author_reputation1,047,093,469,345,700
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,672,497
net_rshares349,027,943,042
author_curate_reward""
vote details (2)
@keys-defender · (edited)
$0.05
@steevc Well it looks like it didn't, you gotta be one of the good guys then 😉

It's not only about the keys this time. The purpose of this feature is to detect early attackers targeting websites and Apps in the Hive ecosystem trying to inject malicious code in blocks to see if it executes in the platform under test. It's a preventive measure that will allow us to know in a timely matter if someone is trying something funky and hopefully even discourage them too as their account name will immediately be known.
👍  
properties (23)
authorkeys-defender
permlinkqgu7nw
categoryhive-139531
json_metadata{"users":["steevc"],"app":"hiveblog/0.1"}
created2020-09-18 04:40:45
last_update2020-09-18 04:41:33
depth2
children1
last_payout2020-09-25 04:40:45
cashout_time1969-12-31 23:59:59
total_payout_value0.025 HBD
curator_payout_value0.025 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length515
author_reputation89,741,592,852,263
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,688,145
net_rshares327,247,646,813
author_curate_reward""
vote details (1)
@steevc ·
We have to be vigilant. With so much money at stake there are bound to be attacks. Thanks.
properties (22)
authorsteevc
permlinkre-keys-defender-qguhn0
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.09.4"}
created2020-09-18 08:16:12
last_update2020-09-18 08:16:12
depth3
children0
last_payout2020-09-25 08:16:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length90
author_reputation1,047,093,469,345,700
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,690,477
net_rshares0
@tngflx ·
Hmm is there even any reported case of using json metadata to steal keys? 
properties (22)
authortngflx
permlinkre-keys-defender-qgu6mp
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.09.4"}
created2020-09-18 04:18:24
last_update2020-09-18 04:18:24
depth1
children1
last_payout2020-09-25 04:18:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length74
author_reputation17,396,455,988,713
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,687,946
net_rshares0
@keys-defender · (edited)
@tngflx No, I'm not sure if anyone ever compromised a site/app in that way but I've seen people testing those attributes too, yes.
Eg. See louis88 (dev, good guy) testing various fields (in several frontends) including communities names and tags: hive.blog/@louis.random

And bear in mind that this bot scans every single type of operation published into Hive, not only the json metadata of posts and comments. I check for leaked keys and potential malicious code in: <i>comment, transfer, custom_json, vote, account_create, account_witness_vote</i>, .. you name it.

 When I did find an active key in an <i>account_update</i> operation it taught me that some human errors will surprise you.

The highest values of saved accounts that leaked their ACTIVE keys so far are: $ ~28,000, $8,000, $1,000. &nbsp; :)
properties (22)
authorkeys-defender
permlinkqgu7db
categoryhive-139531
json_metadata{"users":["tngflx"],"app":"hiveblog/0.1"}
created2020-09-18 04:34:24
last_update2020-09-18 04:42:57
depth2
children0
last_payout2020-09-25 04:34:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length808
author_reputation89,741,592,852,263
root_title"New feature: detection of malicious code in blocks [XSS, SQL INJECTION, CSRF]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,688,095
net_rshares0