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

DNS add-on: Initial version, checking if there is a SPF record. #5044

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

magmax
Copy link

@magmax magmax commented Oct 29, 2023

Overview

Creating a SPF extension. The original idea was to help to recon the applications used via DNS TXT records, but after some discussion we decided to separate it into different ActiveScanners, where this one is dedicated to detect SPF problems.

Related Issues

None

Checklist

  • Update help
  • Update changelog
  • Run ./gradlew spotlessApply for code formatting
  • Write tests
  • Check code coverage
  • Sign-off commits
  • Squash commits
  • Use a descriptive title

For more details, please refer to the developer rules and guidelines.

@magmax magmax force-pushed the dnsrecon branch 2 times, most recently from 84c68a0 to e460a5f Compare October 29, 2023 16:28
@thc202 thc202 changed the title DNS plugin: Initial version, checking if there is a SPF record. [WIP] DNS add-on: Initial version, checking if there is a SPF record. Oct 29, 2023
@thc202 thc202 marked this pull request as draft October 29, 2023 16:38
@thc202
Copy link
Member

thc202 commented Oct 29, 2023

Changed to draft, still a lot of unnecessary/copied code/resources from the example.

Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

All of the ES files should be removed

Copy link
Author

@magmax magmax left a comment

Choose a reason for hiding this comment

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

Thank you very much, @kingthorin, for your detailed review.

Thank you too, @thc202 , for having a look.

I believe I addressed all the findings and should be "good enough", despite it still requires some improvements such as adding solutions to problems and the like.

@thc202
Copy link
Member

thc202 commented Oct 30, 2023

This should be implemented with an active scan rule not passive (passive should act just on existing content). Either way you need to reserve a scan rule ID.

@magmax
Copy link
Author

magmax commented Oct 30, 2023

This should be implemented with an active scan rule not passive (passive should act just on existing content). Either way you need to reserve a scan rule ID.

Yeah, I had my doubts.
Ok, I will change it as soon as I can.

Thank you!

@magmax magmax changed the title [WIP] DNS add-on: Initial version, checking if there is a SPF record. [WIP] SPF add-on: Initial version, checking if there is a SPF record. Nov 5, 2023
@magmax
Copy link
Author

magmax commented Nov 5, 2023

Changed according to conversations.

I tried to write some tests, but not sure if they will work.

@kingthorin
Copy link
Member

I think we lost or confused something along the way. The add-on should still be dns. The current rule will remain SPF for starters.

@magmax
Copy link
Author

magmax commented Nov 5, 2023

@kingthorin Oh, my bad.

So you proposed to keep the dns plugin, but creating several AbstractAppPlugin inside, each one with a different ID. The first one would be the SPF one, righ?

@kingthorin
Copy link
Member

Yup.

@kingthorin
Copy link
Member

Actually AbstractHostPlugin probably makes the most sense. (At least for the scenarios I foresee.)

@thc202
Copy link
Member

thc202 commented Nov 6, 2023

Most of the code was removed instead of renamed.

@kingthorin
Copy link
Member

Let us know if you need help sorting it out.

@kingthorin kingthorin changed the title [WIP] SPF add-on: Initial version, checking if there is a SPF record. [WIP] DNS add-on: Initial version, checking if there is a SPF record. Nov 6, 2023
@magmax
Copy link
Author

magmax commented Nov 7, 2023

@kingthorin sorry, I forgot to add the new files to git after renaming them.

I've been testing it and seem to work fine, but there is an exception. Because the AbstractPlugin requires a HTTP message with its response, in case the plugin acts over a server which doesn't have an HTTP server it will fail silently.

@magmax magmax force-pushed the dnsrecon branch 3 times, most recently from 960cd5d to b21ddfc Compare November 7, 2023 08:18
Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

Started review, will do more later. (Sorry I ran out of time)

@magmax
Copy link
Author

magmax commented Nov 14, 2023

Is there any non-addressed feedback for PR?

@kingthorin
Copy link
Member

Thanks, looks good to me.

@magmax
Copy link
Author

magmax commented Dec 5, 2023

@thc202 do you believe we could remove the WIP mark from this PR?

@thc202
Copy link
Member

thc202 commented Dec 5, 2023

You can (and should) remove it once you think it's ready for merge. (Also mark it ready for review.)

@magmax magmax changed the title [WIP] DNS add-on: Initial version, checking if there is a SPF record. DNS add-on: Initial version, checking if there is a SPF record. Dec 5, 2023
@magmax magmax marked this pull request as ready for review December 5, 2023 12:10
@kingthorin
Copy link
Member

@magmax do you plan to finish this?

@magmax
Copy link
Author

magmax commented Jan 8, 2024

yes, @kingthorin , but latest review included a lot of changes I didn't expected, and I've been out of time this Christmas. I expect to finish it this week.

@kingthorin
Copy link
Member

No problem. Holidays and family are important. No rush, just wanted to know it was still planned 🙂

@magmax
Copy link
Author

magmax commented Jan 8, 2024

I've addressed most part of the feedback. Still to be done:

  • Implement SessionChangeListener to handle DNS cache over sessions. The simplest way is just to remove the current cache (named reviewedDomains).
  • Implement tests for SpfScanRule, what requires mocks and exceeds my current Java habilities (around 15 years not typing Java).
  • Perhaps changing some getConstantString and other private methods into static.

@kingthorin kingthorin added the waiting-for:pr-author This PR is currently waiting for input or changes from the original submitter label Feb 8, 2024
@kingthorin
Copy link
Member

@magmax are you still planning to finish this?

@magmax
Copy link
Author

magmax commented May 15, 2024

@kingthorin apologies for the delay.

I'm afraid I do not find this funny any more. I'm not a java developer and creating a mock for the DNS service requires me too much time, so... no, I'm not going to continue. Anyway, I learned a lot in the process.

Thank you very much.

@thc202 thc202 removed the waiting-for:pr-author This PR is currently waiting for input or changes from the original submitter label May 15, 2024
@kingthorin
Copy link
Member

@magmax no worries. Thanks for what you've done so far!

We can finish it up.

@kingthorin kingthorin self-assigned this May 15, 2024
Signed-off-by: Miguel Angel Garcia <miguelangel.garcia@gmail.com>
Copy link

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@kingthorin
Copy link
Member

Rebased current, addressed a few items. Still needs session handling, example alerts, and rule unit tests. Which I'll work on.

@thc202
Copy link
Member

thc202 commented May 15, 2024

Be good to see a roadmap for the add-on before merging this (and discuss who's going to maintain/improve, as the OP is no longer interested).

@kingthorin
Copy link
Member

From zaproxy/zaproxy#8159 (comment)

  • Check SPF rules
  • Check dmarc rules by checking _dmarc. TXT records
  • Check CAA records
  • Extract information in the same sense "wappalyzer" add-on does from TXT records

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