Writing Nessus injection plugin - "Connection Reset"

5 replies [Last post]
Offline
Joined: 2009-05-04
Posts: 3

Hello -

I'm working on an injection plugin to import findings in the Nessus XML format (*.nessus). I've got it to a point where it basically works, but I'm running into a problem that seems related to the size of one of the data fields.

Each Nessus finding has a field called "Data", that contains most of the finding data. It's got a brief summary, a Risk Factor, and in some cases tons of data about what was actually found. It ranges in size from a few bites to over 6 kB.

If I try to pull in the whole data field, when I run the injection plugin, it always clocks for a few seconds, and then I get a "Connection Reset" error. However, if I modify my plugin so that it truncates the data field to 50 characters, the injection runs successfully. The findings & assets are created as expected. That's not going to work, though, because I'm throwing away tons of important data.

It seems like I'm hitting a size or memory limit and crashing PHP, but I'm not sure what to do about it. I know that the database and the application front-end will accept large blocks of text; I only have the problem when I'm trying to inject large text fields.

Any suggestions?

Thanks,
Mark

Offline
Joined: 2009-04-16
Posts: 89
RE: Writing Nessus injection plugin - "Connection Reset"

Mark --

Sounds like you are running into a limitation of MySQL. I ran into a similar problem when writing the App Detective plugin. Unfortunately, I could not find a workaround except to truncate the data and include a message. Take a look at this:

http://crucible.openfisma.org/browse/OpenFISMA/trunk/library/Fisma/Injec...

In the current version of OpenFISMA, we have added the ability to track a finding back to the file which it was created from. This will enable a user to go back and see all of the details if a finding is, indeed, truncated.

I'd like to hear more details about your Nessus plugin. How far along are you on the development?? Please let me know if you need more support. I would love to see Nessus support built-in to OpenFISMA!

Cheers,

Offline
Joined: 2009-05-04
Posts: 3
RE: Writing Nessus injection plugin - "Connection Reset"

Mark,

I got a bit further with this, but then got side-tracked with other things. This was my first attempt at coding in PHP (I know Python and VB), which was the first hurdle. I stepped through most of the code in an interactive shell and weeded out a few run-time errors due to coding mistakes. But I couldn't figure out how to debug the code while it was running inside OpenFisma. I never did eliminate the "Connection reset" error... maybe I do just need to truncate the data and be done with it. If you have any tips on how to debug, that would help! I haven't been able to get the application to log anything.

Nessus also presented some difficulties. The output isn't all that well standardized; it seems like the authors of the individual plugins have a lot of leeway in terms of the output formatting. But I came up with a set of regexps that work with all the plugins I've used; still, there wouldn't really be any guarantee that a new or updated plugin wouldn't break the injection script.

Also, where the AppDetective plugin is designed to work with one application (i.e. one asset in OpenFisma), Nessus scans usually cover all ports on a machine, and can include mutliple machines (possibly multiple "networks" or "systems" in Openfisma terms). I got around this by mapping the IP addresses to networks and systems within the code. But it was kind of counter-intuitive since you have to select a system on the web interface before importing the scan.

When I have some time I'll take another look at this... if I can't figure it out, maybe I'll just post what I've got and somebody else will be able to make something out of it.

Thanks for the reply - good to see some activity in these forums!
(the other) Mark

Offline
Joined: 2009-05-04
Posts: 3
RE: Writing Nessus injection plugin - "Connection Reset"

I finally got some time to figure this out. Looks like I'm hitting a limit on the length of the finding_data field at 391 characters. If I try to insert any more than that, I get "Connection reset". I'm not sure whether that's something to do with my environment, or the application.

To work around it I'm truncating finding_data. To avoid losing anything, I also stick the full finding_data contents into the threat_source field. Which is interesting... I don't have any issue inserting long text fields into threat_source. If there's a limit on that field, I haven't hit it yet. This isn't the ideal solution, but at least I'm able to smuggle my data into the application this way.

I don't have any issues with length limits when working in the application front-end or in the MySQL database... just when running the Inject plugin. If the devs are interested, I can e-mail you the plugin to take a look at. It could just be a coding error on my part.

mbc
Offline
Joined: 2009-09-09
Posts: 5
Re: Writing Nessus injection plugin - "Connection Reset"

What is the status of the Nessus plugin? I have just installed OpenFISMA 2.4.2 as I am evaluating it, with the goal of finding a replacement for our existing vulnerability management solution. One of the main things I'm looking for is the ability to import Nessus scan results. Thanks for your help.

Offline
Joined: 2009-05-04
Posts: 3
Re: Writing Nessus injection plugin - "Connection Reset"

I had the plugin more or less working under the previous release, although it was a bit of a hack as you can see from the previous comments. I'm thinking about just writing a script to populate the Nessus data into the OpenFisma spreadsheet template format. It seems like that would reduce dependencies on the OpenFisma code, which will change from release to release.

I should point out that I'm not affiliated with the OpenFisma project, and this plugin is a side-project I'm working on as time allows... so I can't really offer any guarantees, but if I wind up with something decent, I'll post it here.