Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new module lfi_detector #1563

Merged
merged 13 commits into from
Mar 5, 2025
Merged

Conversation

dr4g0n369
Copy link
Contributor

Resolves #247

Description

Implements a new module lfi_detector

Progress

  • Using get_links_and_resources_on_same_domain to get links from the given url
  • Detecting lfi using the same mechanism as given in LFI-FINDER
    • Define some common parameters vulnerable to lfi (eg: file, page, load)
    • Give the payloads as inputs to these parameters in different urls obtained from first step -> http://{url}?file={payload1}&page={payload1}&load={payload1}
    • Check if any data from some common files are present (like root:x from /etc/passwd)

I am using sql_injection_detector.py as a reference for making this

Please let me know what changes are needed.

@kazet
Copy link
Member

kazet commented Mar 2, 2025

Thanks for the PR - I have added some minor comments but overall the pull request is very good!

@dr4g0n369
Copy link
Contributor Author

Thanks for the review, I will start working on the changes

@dr4g0n369
Copy link
Contributor Author

I have implemented the changes. Please let me know if anything else is needed.

@dr4g0n369
Copy link
Contributor Author

I have changed the wordlist. Please see if it's all good now.

/etc/hostname.ce3
/etc/hostname.dcelx0
/etc/hostname.dcelx1
/etc/hostname.dcelx2
Copy link
Member

@kazet kazet Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may remove the files we can't automatically detect, such as /etc/hostname, to make the scanning faster

Of course it's only about increasing the speed, so if you remove most of them, not all, it'll be fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, is it possible to find a shorter payload list, e.g. <100? IMO 1000 * number of parameters to test is quite a big number of requests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, that many payloads would put an unnecessary load on the target. I will modify the wordlist to remove the redundant payloads.

@dr4g0n369
Copy link
Contributor Author

dr4g0n369 commented Mar 4, 2025

I have decreased the wordlist size to 177 payloads. Since our aim is just to detect LFI (and not look for sensitive files), I think its sufficient to just verify it using /etc/passwd file. Thus, I have removed the indicator for php and only left indicators for /etc/passwd and Windows .ini file.

This should hopefully not put a lot of burden on a target that we scan.

@kazet kazet merged commit 396227a into CERT-Polska:main Mar 5, 2025
4 checks passed
@kazet
Copy link
Member

kazet commented Mar 5, 2025

Thanks again for your contribution ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace LFI check with an existing tool
2 participants