Hi all,
I'm making this thread to serve as a reminder to the community (especially newer or less technically inclined users) that, although userscripts can be useful and a great way to learn about/practice coding, they can also be used maliciously to manipulate those who have installed them.
Userscripts and Extensions are very popular on Hack Forums, but members should be aware just how much control you are giving the author of the script over your account. When you install a userscript or extension, the script can perform nearly any process that the user has access to. These could be functions for giving reputation, sending PMs, making posts/threads, etc. These events can target any member the author wants and can be triggered by something as simple as a page request.
When installing a userscript I strongly advise you personally look through the code for anything malicious. If you can't read the code, then find someone trustworthy who can check it for you. You also should disable auto-updates for your scripts, so that the the author cannot push malicious code without you noticing.
I've prepared a small proof of concept script called MyRAT to test some basic functions a userscript can do. Below I've posted the userscript code. This is code that you could see in any basic userscript. I will explain what each of the functions does, but I will not be posting the code that sets up and handles the malicious server/functions, of course.
MyRAT Userscript Source
MyRAT opens a socket connection with a server that allows real-time communication between the client and the malicious server. There are 3 functions in the userscript. The names of the functions give away that this is probably not a script that someone would want, but keep in mind that the author can give the functions misleading names in order to hide malicious code. Here are what these functions do:
1) changeUsertitle changes the users usertitle to any usertitle defined by the userscript.
2) sendPM makes the userscript user send a PM to any member with any subject and message.
3) giveRep makes the userscript user give any member any rep within the userscript user's power.
You can imagine how functions like these can maliciously be used - especially when there are hundreds of users who have the userscript installed.
Suppose you install a large userscript with dozens of features. The author of the script could easily bury malicious code within any of the functions and do pretty much anything with your account, because when you install a userscript you give the script the ability to do an action defined by author at a time defined by the author.
I've also prepared a graphic to help understand the flow of data in the order given by the arrows:
Spoiler (Click to View)
Userscripts can add extra desirable, customizable features for users, but they come with their fair share of risks. Poorly coded userscripts can break normal site functions, and malicious userscripts can manipulate your account. I hope that all members proceed with caution when installing userscripts.
I'm making this thread to serve as a reminder to the community (especially newer or less technically inclined users) that, although userscripts can be useful and a great way to learn about/practice coding, they can also be used maliciously to manipulate those who have installed them.
Userscripts and Extensions are very popular on Hack Forums, but members should be aware just how much control you are giving the author of the script over your account. When you install a userscript or extension, the script can perform nearly any process that the user has access to. These could be functions for giving reputation, sending PMs, making posts/threads, etc. These events can target any member the author wants and can be triggered by something as simple as a page request.
When installing a userscript I strongly advise you personally look through the code for anything malicious. If you can't read the code, then find someone trustworthy who can check it for you. You also should disable auto-updates for your scripts, so that the the author cannot push malicious code without you noticing.
I've prepared a small proof of concept script called MyRAT to test some basic functions a userscript can do. Below I've posted the userscript code. This is code that you could see in any basic userscript. I will explain what each of the functions does, but I will not be posting the code that sets up and handles the malicious server/functions, of course.
MyRAT Userscript Source
MyRAT opens a socket connection with a server that allows real-time communication between the client and the malicious server. There are 3 functions in the userscript. The names of the functions give away that this is probably not a script that someone would want, but keep in mind that the author can give the functions misleading names in order to hide malicious code. Here are what these functions do:
1) changeUsertitle changes the users usertitle to any usertitle defined by the userscript.
2) sendPM makes the userscript user send a PM to any member with any subject and message.
3) giveRep makes the userscript user give any member any rep within the userscript user's power.
You can imagine how functions like these can maliciously be used - especially when there are hundreds of users who have the userscript installed.
Suppose you install a large userscript with dozens of features. The author of the script could easily bury malicious code within any of the functions and do pretty much anything with your account, because when you install a userscript you give the script the ability to do an action defined by author at a time defined by the author.
I've also prepared a graphic to help understand the flow of data in the order given by the arrows:
Spoiler (Click to View)
Userscripts can add extra desirable, customizable features for users, but they come with their fair share of risks. Poorly coded userscripts can break normal site functions, and malicious userscripts can manipulate your account. I hope that all members proceed with caution when installing userscripts.
![[Image: WDngpYJ.png]](https://i.imgur.com/WDngpYJ.png)



![[Image: nwEyecB.png]](https://i.imgur.com/nwEyecB.png)
![[Image: DE93-ABEA-2-E28-4-F9-D-9-BB6-312-B3328937-E.png]](https://i.ibb.co/BcJWkqN/DE93-ABEA-2-E28-4-F9-D-9-BB6-312-B3328937-E.png)

![[Image: X9I75i7.gif]](https://i.imgur.com/X9I75i7.gif)


![[Image: ZHJz3bB.gif]](https://i.imgur.com/ZHJz3bB.gif)
