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

feat: mvp router login brute force impl #14

Merged
merged 16 commits into from
Apr 7, 2024
Merged

Conversation

kristoferfannar
Copy link
Contributor

In this PR, a minimally viable version of an admin brute force attack is attempted on the user's router, notifying the user if valid credentials were found.

When activated:

  1. DD finds all JS scripts from the inital http response
  2. finds all possible router http endpoints
  3. Locates endpoints where access is unauthorized
  4. Tries different credentials (using basic auth) on the endpoint
  5. returns the valid credentials to the user if found

@kristoferfannar
Copy link
Contributor Author

New router page:

image

if got_redirect_response(text.as_str()) {
let redirected = get_redirected_response(text.as_str(), client.clone(), address.as_str())
.await
.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a ? to propagate the error instead of causing a panic if the unwrap fails

Copy link
Contributor

@lsig lsig left a comment

Choose a reason for hiding this comment

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

Looks overall good, but would be better to avoid using unwrap in production because of potential panics.

fn find_endpoints_from_code(code: &str) -> Vec<String> {
// find all possible endpoints within the javascript code
let regex_pattern = r#""(/[a-zA-Z0-9\/]+)""#;
let rx = Regex::new(regex_pattern).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Code might panic if regex is not initilized. This is unlikely but maybe better to handle with a result type which returns an error. Then this could look something like this:

-> Result<Vec, Err>

let rx = Regex::new(regex_pattern)?;

Copy link
Contributor

Choose a reason for hiding this comment

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

Also applies to the find_script_src

.send()
.await;

return request.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Unwrap on return can be dangerous

@kristoferfannar
Copy link
Contributor Author

Fixed!

Copy link
Contributor

@lsig lsig left a comment

Choose a reason for hiding this comment

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

Great job!

@lsig lsig merged commit 4f67395 into main Apr 7, 2024
3 checks passed
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.

None yet

2 participants