I have noticed "strange" plug-in errors occurring whenever I use CVS to
maintain my nessus plugins. This includes mangling the script category
so that my windows plugins show up in the "sc" category and other
oddities. This came to a head yesterday when a new system I setup
started receiving fork() errors in the log file for each executed
plugin. This obviously yielded less than desirable results. After
loading nessus in gdb and attaching to the offending processes, I added
some logging in pluginlaunch.c at line 515:
> // XXX DEBUG OUTPUT
> log_write("exec [%x]\n", (*launcher->pl_launch));
(*launcher->pl_launch)(globals,
plugin->value,
hostinfos,
preferences,
key,
name,
ksoc[1]);
I noticed that for the first plugin: smb_scope.nasl, launcher->pl_launch
was set to: 0x805484c, a simple check in gdb showed this to be
nasl_plugin_launch()
HOWEVER, the second and subsequent plungins were execing 0x8054cd0 which
was nes_plugin_launch()! Obviously calling nes_plugin_launch on a nasl
script is not going to go well, hence the fork() errors.
What I discovered was that the pluginload.c code was not checking file
types of files it was calling "plugins". So my CVS directory was being
loaded and causing all types of problems. While I feel that the nessus
code should be robust enough to handle this, I have created the
following patch to fix this PARTICULAR problem by stating the
prospective plugin and only processing files of type S_IFREG. The patch
is small, 3 new lines and 1 changed line.
Renaud, please add this patch to nessus-core/nessusd/pluginload.c
%diff pluginload.c pluginload2.c
82a83
> struct stat sb;
85c86
< while(files[i] == NULL)
---
> while(files[i] == NULL && sb.st_mode != S_IFREG)
88a90,91
> if(files[i] != NULL)
> stat(files[i]->fname, sb);
Regards,
Cory Marsh
[INFO] -- Access Manager:
This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2
82a83
> struct stat sb;
85c86
< while(files[i] == NULL)
---
> while(files[i] == NULL && sb.st_mode != S_IFREG)
88a90,91
> if(files[i] != NULL)
> stat(files[i]->fname, sb);
maintain my nessus plugins. This includes mangling the script category
so that my windows plugins show up in the "sc" category and other
oddities. This came to a head yesterday when a new system I setup
started receiving fork() errors in the log file for each executed
plugin. This obviously yielded less than desirable results. After
loading nessus in gdb and attaching to the offending processes, I added
some logging in pluginlaunch.c at line 515:
> // XXX DEBUG OUTPUT
> log_write("exec [%x]\n", (*launcher->pl_launch));
(*launcher->pl_launch)(globals,
plugin->value,
hostinfos,
preferences,
key,
name,
ksoc[1]);
I noticed that for the first plugin: smb_scope.nasl, launcher->pl_launch
was set to: 0x805484c, a simple check in gdb showed this to be
nasl_plugin_launch()
HOWEVER, the second and subsequent plungins were execing 0x8054cd0 which
was nes_plugin_launch()! Obviously calling nes_plugin_launch on a nasl
script is not going to go well, hence the fork() errors.
What I discovered was that the pluginload.c code was not checking file
types of files it was calling "plugins". So my CVS directory was being
loaded and causing all types of problems. While I feel that the nessus
code should be robust enough to handle this, I have created the
following patch to fix this PARTICULAR problem by stating the
prospective plugin and only processing files of type S_IFREG. The patch
is small, 3 new lines and 1 changed line.
Renaud, please add this patch to nessus-core/nessusd/pluginload.c
%diff pluginload.c pluginload2.c
82a83
> struct stat sb;
85c86
< while(files[i] == NULL)
---
> while(files[i] == NULL && sb.st_mode != S_IFREG)
88a90,91
> if(files[i] != NULL)
> stat(files[i]->fname, sb);
Regards,
Cory Marsh
[INFO] -- Access Manager:
This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2
82a83
> struct stat sb;
85c86
< while(files[i] == NULL)
---
> while(files[i] == NULL && sb.st_mode != S_IFREG)
88a90,91
> if(files[i] != NULL)
> stat(files[i]->fname, sb);