Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    DNS rebind protection not working

    Scheduled Pinned Locked Moved DHCP and DNS
    11 Posts 4 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MikeV7896M
      MikeV7896
      last edited by MikeV7896

      SO... interesting thing here...

      I found this doing a DNS lookup through the pfSense webgui... the IPv4 result being returned is blocked... but there is also an IPv6 version of the IPv4 address that isn't being blocked. Many regular DNS clients will show the IPv6 result here as the IPv4 address, but it shows as a AAAA record in the lookup details through pfSense.

      The unbound.conf man page shows in the private-address section that blocking ::ffff:0:0/96 would block the IPv6 representation of IPv4 addresses... though you could get more granular to just block the specific IPv4 blocks in their IPv6 representations (there may be legitimate instances where using an IPv6 version of an IPv4 address might be necessary). These ranges would be...

      • ::ffff:a00:0/104 (aka 10.0.0.0/8)
      • ::ffff:a9fe:0/112 (aka 169.254.0.0/16)
      • ::ffff:ac10:0/108 (aka 172.16.0.0/12)
      • ::ffff:c0a8:0/112 (aka 192.168.0.0/16)

      Maybe to fully ensure rebinding protection is effective, these should be added to the unbound config as well?

      Edit to add: I added those through the custom options box for Unbound and it's now failing to return results for the rebind test hostnames.

      The S in IOT stands for Security

      1 Reply Last reply Reply Quote 0
      • cwC
        cw
        last edited by

        @virgiliomi said in DNS rebind protection not working:

        ::ffff:c0a8:0/112

        Good work!

        I see "access-control: <IP netblock> <action>" in the documentation for unbound, but that says "The action deny stops queries from hosts from that netblock." Which isn't really what we are looking for since we want to strip those IP ranges from the responses rather than block queries.

        Can you tell me what exactly you added to the unbound custom options box in order to set this up?

        Thanks

        1 Reply Last reply Reply Quote 0
        • MikeV7896M
          MikeV7896
          last edited by MikeV7896

          The private-address option is what you want to use. With it, you can specify IP address ranges that should be considered private, and Unbound will strip the address from any result that might otherwise return it.

          Here's what I added to the custom options...

          server:
          private-address: ::ffff:a00:0/104
          private-address: ::ffff:a9fe:0/112
          private-address: ::ffff:ac10:0/108
          private-address: ::ffff:c0a8:0/112
          

          If you already have a server: line for other options, you can omit that... otherwise, this should do the job. The IPv4 blocks are all using the same option.

          Also created bug 8750 in Redmine for this.

          The S in IOT stands for Security

          1 Reply Last reply Reply Quote 1
          • cwC
            cw
            last edited by

            Confirmed that this fix is working.

            I just went to the web interface and put this into custom options:

            server:
            private-address: ::ffff:a00:0/104
            private-address: ::ffff:a9fe:0/112
            private-address: ::ffff:ac10:0/108
            private-address: ::ffff:c0a8:0/112

            1 Reply Last reply Reply Quote 0
            • johnpozJ
              johnpoz LAYER 8 Global Moderator
              last edited by

              I updated the redmine link with this thread.. Should be an easy fix.. And your work around should be fine.. Have added it to my options as well and set the redmine to watched.

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 24.11 | Lab VMs 2.8, 24.11

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by

                Looks like already got a fix out
                https://redmine.pfsense.org/issues/8750#change-37534

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.8, 24.11

                1 Reply Last reply Reply Quote 0
                • MikeV7896M
                  MikeV7896
                  last edited by

                  Thanks @jimp! 🙂

                  The S in IOT stands for Security

                  1 Reply Last reply Reply Quote 0
                  • W
                    war59312
                    last edited by war59312

                    I noticed this myself, thanks for work-around until officially fixed.

                    Just got my Netgate SG-3100 today.

                    Sadly not working for me though.

                    On Services > DNS Forwarder, "General DNS Forwarder Options" page "services_dnsmasq.php", under "Custom options":

                    server:
                    private-address: ::ffff:a00:0/104
                    private-address: ::ffff:a9fe:0/112
                    private-address: ::ffff:ac10:0/108
                    private-address: ::ffff:c0a8:0/112
                    

                    Save button and get:

                    The following input errors were detected:
                    
                    Invalid custom options
                    

                    Log page @ status_logs.php?logfile=resolver, shows:

                    Aug 29 23:03:46	dnsmasq	10949	bad command line options: try --help
                    Aug 29 23:03:46	dnsmasq	10949	FAILED to start up
                    
                    1 Reply Last reply Reply Quote 0
                    • johnpozJ
                      johnpoz LAYER 8 Global Moderator
                      last edited by

                      Those options are for using the resolver (unbound) which is default - not the forwarder dnsmasq..

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 24.11 | Lab VMs 2.8, 24.11

                      W 1 Reply Last reply Reply Quote 0
                      • W
                        war59312 @johnpoz
                        last edited by

                        @johnpoz Thanks for that. Success. :)

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.