Documentation
¶
Overview ¶
this package is designed to assist a pentester or ethical hacker on checking for Local File Inclusion (LFI) or Directory Traversal vulnerabilities in a target site.
Index ¶
- func UsingDoubleEncoding(opt *LFIOptions) (err error)
- func UsingSSL(opt *LFIOptions) (err error)
- type LFIChecker
- func (l *LFIChecker) CheckParameter(param string) (err error)
- func (l *LFIChecker) CheckSignature() (err error)
- func (l *LFIChecker) CheckSignatureWithParams() (err error)
- func (l *LFIChecker) GetBadLength() (err error)
- func (l *LFIChecker) GetBadLengthParams() (err error)
- func (l *LFIChecker) GetBlankLength() (err error)
- func (l *LFIChecker) GetBodyContent(route string) (bodycontent []byte, err error)
- func (l *LFIChecker) GetGoodLength() (err error)
- func (l *LFIChecker) SetBadRoute(route string) (err error)
- func (l *LFIChecker) SetGoodRoute(route string) (err error)
- type LFIClient
- type LFIOptions
- type LFIOptsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UsingDoubleEncoding ¶
func UsingDoubleEncoding(opt *LFIOptions) (err error)
function designed to set the DoubleEncoding flag for a given LFIOptions object.
func UsingSSL ¶
func UsingSSL(opt *LFIOptions) (err error)
function designed to set the SSLConnection flag for a given LFIOptions object.
Types ¶
type LFIChecker ¶
type LFIChecker struct { // respone length of a known bad route BadLength int // mapping of parameter bad values to return lengths. // these were the lengths returned when CheckBadLengthParams // was executed. BadLengthParams map[string]int // a route that will return a "404 Not Found" response. this route // will be used in various locations to check for LFI. BadRoute string // response length for a blank parameter. // this is only used when URL parameters are specified. BlankLength map[string]int // this is the HTTP client that will be conducting the // requests to the target. Checker LFIClient // LFI filter evasion techniques discovered. this will // be populated with successful evasion techniques when // checking for the LFI signature using CheckSignature. Evasions []string // response length of a known good route. GoodLength int // a route that will return a "200 OK" response. this route // will be used in various locations. GoodRoute string // LFI options associated with this checker Options LFIOptions // return length of a target file test (no param). TestLength int // return length of a target file test using a parameter. TestLengthParams map[string]int // slice holding the vulnerable parameters that have been discovered. VulnerableParams map[string]string }
structure defining the LFIChecker object that will be used to check for LFI/Directory Traversal.
func NewLFIChecker ¶
func NewLFIChecker(baseurl string, usropts ...LFIOptsFunc) (checker *LFIChecker, err error)
function designed to create and initialize a new LFI/Directory Traversal checker and return a pointer to it to the user. this returns a pointer to the LFIChecker object and nil if no error occurs, otherwise it returns nil and an error.
func (*LFIChecker) CheckParameter ¶ added in v0.0.10
func (l *LFIChecker) CheckParameter(param string) (err error)
function designed to check an individual URL parameter for an LFI/Directory Traversal vulnerability.
func (*LFIChecker) CheckSignature ¶ added in v0.0.7
func (l *LFIChecker) CheckSignature() (err error)
function designed to check for an LFI signature using the current LFIChecker configuration. this will compare the various lengths and attempt to determine if LFI is present on the target. if no LFI is present, an error will be returned.
func (*LFIChecker) CheckSignatureWithParams ¶ added in v0.0.7
func (l *LFIChecker) CheckSignatureWithParams() (err error)
function designed to check for an LFI signature using the current LFIChecker configuration. this will target URL parameters, compare various lengths and attempt to determine if LFI is present on the target. if no LFI is present, an error will be returned.
func (*LFIChecker) GetBadLength ¶
func (l *LFIChecker) GetBadLength() (err error)
function designed to contact the target and get the length of a request that returns a 404 NOT FOUND response. this length can be used as part of the check for LFI/Directory Traversal.
func (*LFIChecker) GetBadLengthParams ¶ added in v0.0.10
func (l *LFIChecker) GetBadLengthParams() (err error)
function designed to check for the return length when a bad parameter value is passed in.
func (*LFIChecker) GetBlankLength ¶ added in v0.0.10
func (l *LFIChecker) GetBlankLength() (err error)
function designed to get the return length when a blank parameter is passed to the target.
func (*LFIChecker) GetBodyContent ¶ added in v0.0.8
func (l *LFIChecker) GetBodyContent(route string) (bodycontent []byte, err error)
function designed to perform an HTTP GET request on a target route, returning the body content of the resonse. this is useful when checking the response length of a target route.
func (*LFIChecker) GetGoodLength ¶
func (l *LFIChecker) GetGoodLength() (err error)
function designed to contact the target and get the length of a request that returns a 200 OK response. this length can be used as part of the check for LFI/Directory Traversal.
func (*LFIChecker) SetBadRoute ¶
func (l *LFIChecker) SetBadRoute(route string) (err error)
function designed to set the BadRoute parameter in the LFIChecker object.
func (*LFIChecker) SetGoodRoute ¶
func (l *LFIChecker) SetGoodRoute(route string) (err error)
function designed to set the GoodRoute parameter in the LFIChecker object.
type LFIClient ¶
type LFIClient struct {
// contains filtered or unexported fields
}
structure defining an LFIClient object that will be used to conduct requests to the target.
type LFIOptions ¶
type LFIOptions struct { // URL parameters to test when checking for LFI. if this slice // is empty, no parameters will be tested. // // default: empty Parameters map[string]string // switch indicating whether to use double URL encoding to attempt // to evade directory traversal filters. // // default: false DoubleEncoding bool // switch indicating whether to attempt to connect to the target // using HTTPS. // // default: false SSLConnection bool // file to target when testing for LFI TargetFile string }
structure defining the various LFI testing options the checker has.
type LFIOptsFunc ¶
type LFIOptsFunc func(*LFIOptions) error
type alias defining a function that manipulates an LFIOptions object.
func WithParameter ¶ added in v0.0.10
func WithParameter(param string, goodval string) LFIOptsFunc
function designed to add a parameter to the LFI testing options. this will take in a param and goodval (value that does not fail).
func WithTarget ¶ added in v0.0.10
func WithTarget(targetfile string) LFIOptsFunc