200
Date: Tue, 28 Apr 2009 17:38:32 +0200
I was joking . I wish they are ok.
Francione Fabrizio
> Date: Tue, 28 Apr 2009 12:26:57 -0300
> Subject: Re: [W3af-develop] contribution
> From: andres.rian...@gmail.com
> To: lordfa...@hotmail.it
>
> Fabrizio,
>
> On Tue, Apr 28, 2009 at 12:12 PM, Fabrizio Francione
> <lordfa...@hotmail.it> wrote:
> > ok i'm working on audit.bufferOverflow.py and audit.dav.py. As soon i've
> > finished i'll post you the two files compiled.
>
> No need to compile anything it's python =)
> Just send me the bufferOverflow.py and dav.py files.
>
> > Francione Fabrizio
> >
> >
> >
> >
> >> Date: Tue, 28 Apr 2009 11:45:28 -0300
> >> Subject: Re: [W3af-develop] contribution
> >> From: andres.rian...@gmail.com
> >> To: lordfa...@hotmail.it
> >> CC: w3af-develop@lists.sourceforge.net
> >>
> >> Fabrizio,
> >>
> >> On Tue, Apr 28, 2009 at 11:41 AM, Fabrizio Francione
> >> <lordfa...@hotmail.it> wrote:
> >> > yes, i can try.audit core is in w3af/plugins/audit right?
> >>
> >> Yes, the audit plugins are in w3af/plugins/audit. Please work with the
> >> latest version from the SVN, which is available for download issuing
> >> the command:
> >>
> >> svn co https://w3af.svn.sourceforge.net/svnroot/w3af/trunk w3af
> >>
> >> For starters, please modify two plugins (you choose which) and send
> >> them to me for review, I'll commit your changes to the SVN. After
> >> that, we'll keep on working that way until you manage to add that
> >> feature to all audit plugins.
> >>
> >> Thanks!
> >>
> >> PS: Please answer the emails inline.
> >>
> >> > Francione Fabrizio
> >> >
> >> >
> >> >
> >> >
> >> >> Date: Tue, 28 Apr 2009 10:39:13 -0300
> >> >> Subject: Re: [W3af-develop] contribution
> >> >> From: andres.rian...@gmail.com
> >> >> To: lordfa...@hotmail.it
> >> >> CC: w3af-develop@lists.sourceforge.net
> >> >>
> >> >> Fabrizio,
> >> >>
> >> >> On Tue, Apr 28, 2009 at 10:21 AM, Fabrizio Francione
> >> >> <lordfa...@hotmail.it> wrote:
> >> >> >
> >> >> > Hello everybody!
> >> >> >
> >> >> > How can i help you in this cool project ,w3af?
> >> >>
> >> >> Thanks for considering contributing with the w3af project. We are
> >> >> always looking for new people to help us improve w3af and achieve to
> >> >> the highest levels of quality.
> >> >>
> >> >> One of the latest features that were added to w3af, was the
> >> >> highlighting of the text from which the vulnerability was identified.
> >> >> You should have noted this in the results tab of the GUI, in the
> >> >> response of each of the grep plugins you'll see how the "vulnerable
> >> >> string" was highlighted.
> >> >>
> >> >> For example, if a request is made to the server, and the
> >> >> grep.privateIP finds a private IP address, you'll be able to see that
> >> >> IP address highlighted in the response part of the results tab.
> >> >>
> >> >> To highlight a text in the GUI, you need to set the following to the
> >> >> info or vuln object: "v.addToHighlight( match )". Here is a small
> >> >> copy+paste from the grep.privateIP plugin:
> >> >>
> >> >> """
> >> >> v = vuln.vuln()
> >> >> v.setURL( response.getURL() )
> >> >> v.setId( response.id )
> >> >> v.setSeverity(severity.LOW)
> >> >> v.setName( 'Private IP disclosure vulnerability' )
> >> >>
> >> >> msg = 'The URL: "' + v.getURL() + '" returned an
> >> >> HTTP header '
> >> >> msg += 'with an IP address: "' + match + '".'
> >> >> v.setDesc( msg )
> >> >> v['IP'] = match
> >> >> v.addToHighlight( match )
> >> >> """
> >> >>
> >> >> Your task, if you want to accept it, is really simple: add the
> >> >> "addToHighlight" method, with the corresponding parameter, to all
> >> >> audit plugins. For example, in the audit.sqli plugin, after line #84,
> >> >> you would need to add something like "v.addToHighlight( sql_error )".
> >> >>
> >> >> What do you think about the task? Will you be able to perform it?
> >> >>
> >> >> > I know some c,html and java.
> >> >>
> >> >> Cool, this will help,
> >> >>
> >> >> > thanks!
> >> >>
> >> >> Thank you!
> >> >>
> >> >> > bye!
> >> >> > Francione Fabrizio
> >> >> >
> >> >> >
> >> >> >
> >> >> > ________________________________
> >> >> > È arrivato il nuovo Messenger! Provalo subito
> >> >> >
> >> >> >
> >> >> > ------------------------------------------------------------------------------
> >> >> > Register Now & Save for Velocity, the Web Performance & Operations
> >> >> > Conference from O'Reilly Media. Velocity features a full day of
> >> >> > expert-led, hands-on workshops and two days of sessions from industry
> >> >> > leaders in dedicated Performance & Operations tracks. Use code
> >> >> > vel09scf
> >> >> > and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> >> >> > _______________________________________________
> >> >> > W3af-develop mailing list
> >> >> > W3af-develop@lists.sourceforge.net
> >> >> > https://lists.sourceforge.net/lists/listinfo/w3af-develop
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Andrés Riancho
> >> >> http://www.bonsai-sec.com/
> >> >> http://w3af.sourceforge.net/
> >> >
> >> > ________________________________
> >> > Il remix esclusivo di Messenger. Scaricalo gratis!
> >> >
> >> > ------------------------------------------------------------------------------
> >> > Register Now & Save for Velocity, the Web Performance & Operations
> >> > Conference from O'Reilly Media. Velocity features a full day of
> >> > expert-led, hands-on workshops and two days of sessions from industry
> >> > leaders in dedicated Performance & Operations tracks. Use code vel09scf
> >> > and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> >> > _______________________________________________
> >> > W3af-develop mailing list
> >> > W3af-develop@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/w3af-develop
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Andrés Riancho
> >> http://www.bonsai-sec.com/
> >> http://w3af.sourceforge.net/
> >
> > ________________________________
> > 25 GB di spazio gratuito su Internet! Prova SkyDrive
> > ------------------------------------------------------------------------------
> > Register Now & Save for Velocity, the Web Performance & Operations
> > Conference from O'Reilly Media. Velocity features a full day of
> > expert-led, hands-on workshops and two days of sessions from industry
> > leaders in dedicated Performance & Operations tracks. Use code vel09scf
> > and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> > _______________________________________________
> > W3af-develop mailing list
> > W3af-develop@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/w3af-develop
> >
> >
>
>
>
> --
> Andrés Riancho
> http://www.bonsai-sec.com/
> http://w3af.sourceforge.net/
Dillo con le Emoticon! Scarica il nuovo Messenger 2009
25 GB di spazio gratuito su Internet! Prova SkyDrive
_________________________________________________________________
È arrivato il nuovo Messenger! Provalo subito
http://clk.atdmt.com/GBL/go/140630370/direct/01/
'''
dav.py
Copyright 2006 Andres Riancho
This file is part of w3af, w3af.sourceforge.net .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with w3af; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
'''
import core.controllers.outputManager as om
# options
from core.data.options.option import option
from core.data.options.optionList import optionList
from core.controllers.basePlugin.baseAuditPlugin import baseAuditPlugin
import core.data.kb.knowledgeBase as kb
import core.data.kb.vuln as vuln
import core.data.kb.info as info
import core.data.constants.severity as severity
from core.data.db.temp_persist import disk_list
from core.controllers.w3afException import w3afException
import core.data.parsers.urlParser as urlParser
from core.data.fuzzer.fuzzer import createRandAlpha, createRandAlNum
class dav(baseAuditPlugin):
'''
Verify if the WebDAV module is properly configured.
@author: Andres Riancho ( andres.rian...@gmail.com )
'''
def __init__(self):
baseAuditPlugin.__init__(self)
# Internal variables
self.is_404 = None
self._already_tested_dirs = disk_list()
def audit(self, freq ):
'''
Searches for file upload vulns using PUT method.
@param freq: A fuzzableRequest
'''
# Init...
if self.is_404 == None:
self.is_404 = kb.kb.getData( 'error404page', '404' )
# Start
domain_path = urlParser.getDomainPath( freq.getURL() )
if domain_path not in self._already_tested_dirs:
om.out.debug( 'dav plugin is testing: ' + freq.getURL() )
self._already_tested_dirs.append( domain_path )
self._PUT( domain_path )
self._PROPFIND( domain_path )
self._SEARCH( domain_path )
v.addToHighlight( freq.getURL() )
def _SEARCH( self, domain_path ):
'''
Test SEARCH method.
'''
content = "<?xml version='1.0'?>\r\n"
content += "<g:searchrequest xmlns:g='DAV:'>\r\n"
content += "<g:sql>\r\n"
content += "Select 'DAV:displayname' from scope()\r\n"
content += "</g:sql>\r\n"
content += "</g:searchrequest>\r\n"
res = self._urlOpener.SEARCH( domain_path , data=content )
content_matches = '<a:response>' in res or '<a:status>' in res or 'xmlns:a="DAV:"' in res
if content_matches and res.getCode() in xrange(200, 300):
v = vuln.vuln()
v.setURL( res.getURL() )
v.setId( res.id )
v.setSeverity(severity.MEDIUM)
v.setName( 'Insecure DAV configuration' )
v.setMethod( 'SEARCH' )
msg = 'Directory listing with HTTP SEARCH method was found at directory: "'
msg += domain_path + '"'
v.setDesc( msg )
kb.kb.append( self, 'dav', v )
v.addToHighlight( domain_path )
def _PROPFIND( self, domain_path ):
'''
Test PROPFIND method
'''
content = "<?xml version='1.0'?>\r\n"
content += "<a:propfind xmlns:a='DAV:'>\r\n"
content += "<a:prop>\r\n"
content += "<a:displayname:/>\r\n"
content += "</a:prop>\r\n"
content += "</a:propfind>\r\n"
res = self._urlOpener.PROPFIND( domain_path , data=content, headers={'Depth': '1'} )
# Remember that httpResponse objects have a faster "__in__" than
# the one in strings; so string in response.getBody() is slower than
# string in response
if "D:href" in res and res.getCode() in xrange(200, 300):
v = vuln.vuln()
v.setURL( res.getURL() )
v.setId( res.id )
v.setSeverity(severity.MEDIUM)
v.setName( 'Insecure DAV configuration' )
v.setMethod( 'PROPFIND' )
msg = 'Directory listing with HTTP PROPFIND method was found at directory: "'
msg += domain_path + '"'
v.setDesc( msg )
kb.kb.append( self, 'dav', v )
v.addToHighlight( domain_path )
def _PUT( self, domain_path ):
'''
Tests PUT method.
'''
# upload
url = urlParser.urlJoin( domain_path, createRandAlpha( 5 ) )
rndContent = createRandAlNum(6)
put_response = self._urlOpener.PUT( url , data=rndContent )
# check if uploaded
res = self._urlOpener.GET( url , useCache=True )
if res.getBody() == rndContent:
v = vuln.vuln()
v.setURL( url )
v.setId( [put_response.id, res.id] )
v.setSeverity(severity.HIGH)
v.setName( 'Insecure DAV configuration' )
v.setMethod( 'PUT' )
msg = 'File upload with HTTP PUT method was found at resource: "' + domain_path + '".'
msg += ' A test file was uploaded to: "' + res.getURL() + '".'
v.setDesc( msg )
kb.kb.append( self, 'dav', v )
v.addToHighlight( domain_path )
v.addToHighlight( res.getURL() )
# Report some common errors
elif put_response.getCode() == 500:
i = info.info()
i.setURL( url )
i.setId( res.id )
i.setName( 'DAV incorrect configuration' )
i.setMethod( 'PUT' )
msg = 'DAV seems to be incorrectly configured. The web server answered with a 500'
msg += ' error code. In most cases, this means that the DAV extension failed in'
msg += ' some way. This error was found at: "' + put_response.getURL() + '".'
i.setDesc( msg )
kb.kb.append( self, 'dav', i )
v.addToHighlight( put_response.getURL() )
# Report some common errors
elif put_response.getCode() == 403:
i = info.info()
i.setURL( url )
i.setId( res.id )
i.setName( 'DAV insufficient privileges' )
i.setMethod( 'PUT' )
msg = 'DAV seems to be correctly configured and allowing you to use the PUT method'
msg +=' but the directory does not have the correct permissions that would allow'
msg += ' the web server to write to it. This error was found at: "'
msg += put_response.getURL() + '".'
i.setDesc( msg )
kb.kb.append( self, 'dav', i )
v.addToHighlight( put_response.getURL() )
def end(self):
'''
This method is called when the plugin wont be used anymore.
'''
self.printUniq( kb.kb.getData( 'dav', 'dav' ), 'VAR' )
def getOptions( self ):
'''
@return: A list of option objects for this plugin.
'''
ol = optionList()
return ol
def setOptions( self, optionMap ):
'''
This method sets all the options that are configured using the user interface
generated by the framework using the result of getOptions().
@parameter OptionList: A dictionary with the options for the plugin.
@return: No value is returned.
'''
pass
def getPluginDeps( self ):
'''
@return: A list with the names of the plugins that should be runned before the
current one.
'''
return ['discovery.allowedMethods', 'discovery.serverHeader']
def getLongDesc( self ):
'''
@return: A DETAILED description of the plugin functions and features.
'''
return '''
This plugin finds WebDAV configuration errors. These errors are generally server configuration errors rather
than a web application errors. To check for vulnerabilities of this kind, the plugin will try to PUT a file on a directory
that has WebDAV enabled, if the file is uploaded successfully, then we have found a bug.
'''
'''
buffOverflow.py
Copyright 2006 Andres Riancho
This file is part of w3af, w3af.sourceforge.net .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with w3af; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
'''
import core.controllers.outputManager as om
from core.controllers.basePlugin.baseAuditPlugin import baseAuditPlugin
from core.controllers.w3afException import w3afException, w3afMustStopException
from core.data.fuzzer.fuzzer import createMutants, createRandAlpha
import core.data.kb.knowledgeBase as kb
import core.data.kb.vuln as vuln
import core.data.kb.info as info
import core.data.constants.severity as severity
# options
from core.data.options.option import option
from core.data.options.optionList import optionList
class buffOverflow(baseAuditPlugin):
'''
Find buffer overflow vulnerabilities.
@author: Andres Riancho ( andres.rian...@gmail.com )
'''
def __init__(self):
'''
Some notes:
On apache, when an overflow happends on a cgic script, this is written to the log:
*** stack smashing detected ***: /var/www/w3af/bufferOverflow/buffOverflow.cgi terminated, referer: http://localhost/w3af/bufferOverflow/buffOverflow.cgi
Premature end of script headers: buffOverflow.cgi, referer: http://localhost/w3af/bufferOverflow/buffOverflow.cgi
On apache, when an overflow happends on a cgic script, this is returned to the user:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
webmas...@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.0.55 (Ubuntu) mod_python/3.2.8 Python/2.4.4c1 PHP/5.1.6 Server at localhost Port 80</address>
</body></html>
Note that this is an apache error 500, not the more common PHP error 500.
'''
baseAuditPlugin.__init__(self)
def audit(self, freq ):
'''
Tests an URL for buffer overflow vulnerabilities.
@param freq: A fuzzableRequest
'''
om.out.debug( 'bufferOverflow plugin is testing: ' + freq.getURL() )
str_list = self._get_string_list()
oResponse = self._sendMutant( freq , analyze=False ).getBody()
mutants = createMutants( freq , str_list, oResponse=oResponse )
for mutant in mutants:
targs = (mutant,)
self._tm.startFunction( target=self._sendMutant, args=targs, ownerObj=self )
def _sendMutant( self, mutant, analyze=True, grepResult=True ):
'''
Sends a mutant to the remote web server. I override the _sendMutant of basePlugin
just to handle errors in a different way.
'''
url = mutant.getURI()
data = mutant.getData()
headers = mutant.getHeaders()
# Also add the cookie header.
cookie = mutant.getCookie()
if cookie:
headers['Cookie'] = str(cookie)
args = ( url, )
method = mutant.getMethod()
functor = getattr( self._urlOpener , method )
try:
kwdargs = {'data': data, 'headers': headers, 'grepResult': grepResult }
res = apply( functor, args, kwdargs )
except (w3afException,w3afMustStopException):
i = info.info( mutant )
i.setName( 'Possible buffer overflow vulnerability' )
if data:
msg = 'A possible (most probably a false positive than a bug) buffer overflow was'
msg += ' found when requesting: "' + url + '", using HTTP method ' + method
msg += '. The data sent was: "' + data + '".'
i.setDesc( msg )
v.addToHighlight( url )
v.addToHighlight( method )
v.addToHighlight( data )
else:
msg = 'A possible (most probably a false positive than a bug) buffer overflow was'
msg += ' found when requesting: "' + url + '", using HTTP method ' + method + '.'
i.setDesc( msg )
kb.kb.append( self, 'buffOverflow', i )
v.addToHighlight( url )
v.addToHighlight( method )
else:
if analyze:
self._analyzeResult( mutant, res )
return res
def _get_string_list( self ):
'''
@return: This method returns a list of strings that could overflow a buffer.
'''
strings = []
lengths = [ 65 , 257 , 513 , 1025, 2049 ]
### TODO !! if lengths = [ 65 , 257 , 513 , 1025, 2049, 4097, 8000 ]
### then i get a badStatusLine exception from urllib2, is seems to be a internal error.
### tested against tomcat 5.5.7
for i in lengths:
strings.append( createRandAlpha( i ) )
return strings
def _analyzeResult( self, mutant, response ):
'''
Analyze results of the _sendMutant method.
'''
for error in self._get_errors():
# Check if the error string is in the response
if error in response:
# And not in the originally requested (non fuzzed) request
if not error not in mutant.getOriginalResponseBody():
# vuln, vuln!
v = vuln.vuln( mutant )
v.setId( response.id )
v.setSeverity(severity.MEDIUM)
v.setName( 'Buffer overflow vulnerability' )
msg = 'A possible buffer overflow (detection is really hard...) was found at: '
msg += mutant.foundAt()
v.setDesc( msg )
kb.kb.append( self, 'buffOverflow', v )
v.addToHighlight( mutant.foundAt )
def end(self):
'''
This method is called when the plugin wont be used anymore.
'''
self._tm.join( self )
self.printUniq( kb.kb.getData( 'buffOverflow', 'buffOverflow' ), 'VAR' )
def _get_errors( self ):
'''
@return: A list of errors that are shown when a buffer overflow is triggered
'''
res = []
error = '<html><head>\n<title>500 Internal Server Error</title>\n</head><body>\n<h1>'
error += 'Internal Server Error</h1>'
res.append( error )
res.append('*** stack smashing detected ***:')
res.append('Backtrace:')
res.append('Memory map:')
return res
def getOptions( self ):
'''
@return: A list of option objects for this plugin.
'''
ol = optionList()
return ol
def setOptions( self, OptionList ):
'''
This method sets all the options that are configured using the user interface
generated by the framework using the result of getOptions().
@parameter OptionList: A dictionary with the options for the plugin.
@return: No value is returned.
'''
pass
def getPluginDeps( self ):
'''
@return: A list with the names of the plugins that should be runned before the
current one.
'''
return ['grep.error500']
def getLongDesc( self ):
'''
@return: A DETAILED description of the plugin functions and features.
'''
return '''
This plugin finds buffer overflow vulnerabilities.
Users have to know that detecting a buffer overflow vulnerability will be only possible if the server is configured
to return errors, and the application is developed in cgi-c or some other language that allows the programmer to
do their own memory management.
'''
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
W3af-develop mailing list
W3af-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/w3af-develop