From WikiChip
Editing mirc/msl injection

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 62: Line 62:
 
Indeed, /timer evaluated the parameter once: $2 is evaluated to 18000 and $3- to "jill's birthday tomorrow!"
 
Indeed, /timer evaluated the parameter once: $2 is evaluated to 18000 and $3- to "jill's birthday tomorrow!"
  
The associated command of the timer is correctly <code>notice Mike [Reminder] jill's birthday tomorrow! (Set 18000 seconds ago)</code>, when the timer fires, the /notice command will see its parameters evaluated once, but there is nothing to evaluate in this case.
+
The associated command of the timer is correctly "notice Mike [Reminder] jill's birthday tomorrow! (Set 18000 seconds ago)", when the timer fires, the /notice command will see its parameters evaluated once, but there is nothing to evaluate in this case.
  
 
Although this script might seem simple, let's take a look at what happens when someone provides incorrect or even malicious input as in this case:
 
Although this script might seem simple, let's take a look at what happens when someone provides incorrect or even malicious input as in this case:
Line 72: Line 72:
 
This is an msl injection attack. Let's take a deeper look into what has happened:
 
This is an msl injection attack. Let's take a deeper look into what has happened:
  
As we know, /timer evaluated the parameter once; $2 is evaluated to <code>0</code> and $3- is evaluated to <code>. | ns drop nick | quit hacked!</code>
+
As we know, /timer evaluated the parameter once; $2 is evaluated to 0 and $3- is evaluated to ". | ns drop nick | quit hacked!"
  
So now, the associated command of the timer becomes <code>.notice Mike [Reminder] . | ns drop nick | quit hacked!</code> and you might be recognizing the pipe character, used to separate commands, which mIRC will interpret as such, resulting in /ns drop nick and /quit hacked! being executed.
+
So now, the associated command of the timer becomes "notice Mike [Reminder] . | ns drop nick | quit hacked!" and you might be recognizing the pipe character, used to seperate commands, which mIRC will interpret as such, resulting in /ns drop nick and /quit hacked! being executed.
  
 
Clearly, you can see how the timer command can be extremely dangerous. The unfortunate part is that there is no clean way of solving this problem. The only way to prevent this from happening is to encode the problematic parameters so that when they get evaluated, they produce something which needs one more evaluation to produce the correct value. We usually do that by encoding the parameters using based64 encoding. Below is an alias to perform this:
 
Clearly, you can see how the timer command can be extremely dangerous. The unfortunate part is that there is no clean way of solving this problem. The only way to prevent this from happening is to encode the problematic parameters so that when they get evaluated, they produce something which needs one more evaluation to produce the correct value. We usually do that by encoding the parameters using based64 encoding. Below is an alias to perform this:
Line 97: Line 97:
 
And Mike now can't do anything harmful.
 
And Mike now can't do anything harmful.
  
/timer will evaluate the parameter as we know but this time, $safe($3-) where $3- is <code>. | ns drop nick | quit hacked!</code> is evaluated to <code>{{mIRC|$decode}}( LiB8IG5zIGRyb3AgbmljayB8IHF1aXQgaGFja2VkIQ== ,m)</code> and $safe($2) to <code>{{mIRC|$decode}}( MTgwMDA= ,m)</code>.
+
/timer will evaluate the parameter as we know but this time, $safe($3-) where $3- is ". | ns drop nick | quit hacked!" is evaluated to "{{mIRC|$decode}}( LiB8IG5zIGRyb3AgbmljayB8IHF1aXQgaGFja2VkIQ== ,m)" and $safe($2) to "{{mIRC|$decode}}( MTgwMDA= ,m)".
  
The command associated with the timer now becomes <code>{{mIRC|/notice}} Mike [Reminder] {{mIRC|$decode}}( LiB8IG5zIGRyb3AgbmljayB8IHF1aXQgaGFja2VkIQ== ,m) (Set {{mIRC|$decode}}( MTgwMDA= ,m) seconds ago)</code> and those {{mIRC|$decode}}, when evaluated once by {{mIRC|/notice}}, will produce the correct result (the original input of Mike).
+
The command associated with the timer nows becomes "{{mIRC|/notice}} Mike [Reminder] {{mIRC|$decode}}( LiB8IG5zIGRyb3AgbmljayB8IHF1aXQgaGFja2VkIQ== ,m) (Set {{mIRC|$decode}}( MTgwMDA= ,m) seconds ago)" and those {{mIRC|$decode}}, when evaluated once by {{mIRC|/notice}}, will produce the correct result (the original input of Mike).
  
 
Now you don't need to do that for any {{mIRC|/timer}} command of course, only when the parameter is unknown at the time you are writing the script, such as $2 and $3- here.
 
Now you don't need to do that for any {{mIRC|/timer}} command of course, only when the parameter is unknown at the time you are writing the script, such as $2 and $3- here.
Line 169: Line 169:
 
}</syntaxhighlight>
 
}</syntaxhighlight>
  
The associated command becomes <code>amsg [AMSG] %a</code> and %a is evaluated correctly to produce the user's message.
+
The associated command becomes "amsg [AMSG] %a" and %a is evaluated correctly to produce the user's message.
  
 
'''Note''': /scid and /scon can be used to change the current connection only, in this case you can just execute the command normally after, does not work for /scon -a for example.
 
'''Note''': /scid and /scon can be used to change the current connection only, in this case you can just execute the command normally after, does not work for /scon -a for example.

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)