|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: 'Subdomain enumeration with wildcard records ' |
| 4 | +date: 2021-07-31 13:49:00 -0300 |
| 5 | +comments: true |
| 6 | +categories: footprinting, subdomain, dns |
| 7 | +--- |
| 8 | + |
| 9 | +**TL;DR** |
| 10 | + |
| 11 | +Enumerating subdomains with wildcard records is tricky but not impossible, here |
| 12 | +are some tips. Also, don't trust wildcards as a security mechanism for hiding |
| 13 | +sensitive apps. |
| 14 | + |
| 15 | +# The problem |
| 16 | + |
| 17 | +If you did some subdomain brute-force enumeration in the wild you already |
| 18 | +bumped into a record that resolves for any type of prefix. This is called a |
| 19 | +wildcard record and it can be configured by inserting a record entry with a |
| 20 | +label "**\***". This record will also resolve for other sublevels unless it is |
| 21 | +inhibited by another record entry. |
| 22 | + |
| 23 | +Many companies use wildcard records as part of their architecture. A well-known |
| 24 | +example is Slack which uses it for their workspaces. For example, today I asked |
| 25 | +my favorite DNS server to resolve the following records and got the same IP |
| 26 | +address: |
| 27 | + |
| 28 | +``` |
| 29 | +shopify.enterprise.slack.com 18.231.0.250 |
| 30 | +enterprise.slack.com 18.231.0.250 |
| 31 | +big-name-non-existent.slack.com 18.231.0.250 |
| 32 | +``` |
| 33 | + |
| 34 | +In this case you might conclude that there is a wildcard record |
| 35 | +**\*.slack.com** and maybe we should ignore this domain in your subdomain |
| 36 | +enumeration. However, you could end up missing something like |
| 37 | +**status.slack.com** which does not resolve to this address. Instead it has a |
| 38 | +CNAME pointing to another infrastructure that could be interesting to you. |
| 39 | + |
| 40 | +It is curious how often subdomain enumeration tools mess up or do not handle |
| 41 | +this kind of behaviour. Many times the wildcard records are just dropped |
| 42 | +without any further check. The problem is that you might lose some interesting |
| 43 | +apps by discarding them . |
| 44 | + |
| 45 | +With that in mind, adding a wildcard record can be a tempting strategy to hide |
| 46 | +your own services like a needle in the haystack. I can't blame anyone for doing |
| 47 | +that, but just keep in mind that this is not going to save you for long. |
| 48 | + |
| 49 | +# Finding interesting stuff |
| 50 | + |
| 51 | +Thinking about how to make a better reconnaissance one could try to overcome |
| 52 | +this problem by treating enumeration in wildcard records differently. The |
| 53 | +response returned by the wildcard could be stored (sorted if it is multiple |
| 54 | +entries) and every subsequent DNS response would be compared with this one. |
| 55 | +Everytime we find a new response it would be saved in a map structure. |
| 56 | + |
| 57 | +This would make sure we have at least one subdomain that points to that new |
| 58 | +location that we found. However, *the world ain't all sunshine and rainbows* |
| 59 | +and we could obviously have a different application sitting on a machine that |
| 60 | +will only show up when we set a specific Host header in the HTTP request. |
| 61 | + |
| 62 | +Therefore, this is just something you could use to have more places to look for |
| 63 | +security vulnerabilities. There are many other more edgy cases (for example |
| 64 | +when including CNAME) that can happen when trying to find assets using DNS. I |
| 65 | +hope I can dig into that more in future posts. |
| 66 | + |
| 67 | +Do you have any tips for finding apps on records with wildcard? |
0 commit comments