Skip to content

Commit

Permalink
CVE-2019-12435 rpc/dns: avoid NULL deference if zone not found in Dns…
Browse files Browse the repository at this point in the history
…srvOperation2

We still want to return DOES_NOT_EXIST when request_filter is not 0.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13922

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
  • Loading branch information
douglasbagnall authored and kseeger committed Jun 13, 2019
1 parent 0b9da24 commit d32b96a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
26 changes: 26 additions & 0 deletions python/samba/tests/dcerpc/dnsserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,32 @@ def test_operation_invalid(self):
# We should always encounter a DOES_NOT_EXIST error.
self.fail()

# This test is to confirm that we do not support multizone operations,
# which are designated by a non-zero dwContext value (the 5th argument
# to DnssrvOperation2).
def test_operation2_invalid(self):
client_version = dnsserver.DNS_CLIENT_VERSION_LONGHORN
non_zone = 'a-zone-that-does-not-exist'
typeid = dnsserver.DNSSRV_TYPEID_NAME_AND_PARAM
name_and_param = dnsserver.DNS_RPC_NAME_AND_PARAM()
name_and_param.pszNodeName = 'AllowUpdate'
name_and_param.dwParam = dnsp.DNS_ZONE_UPDATE_SECURE
try:
res = self.conn.DnssrvOperation2(client_version,
0,
self.server,
non_zone,
1,
'ResetDwordProperty',
typeid,
name_and_param)
except WERRORError as e:
if e.args[0] == werror.WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST:
return

# We should always encounter a DOES_NOT_EXIST error.
self.fail()

def test_operation2(self):
client_version = dnsserver.DNS_CLIENT_VERSION_LONGHORN
rev_zone = '1.168.192.in-addr.arpa'
Expand Down
7 changes: 6 additions & 1 deletion source4/rpc_server/dnsserver/dcerpc_dnsserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,12 @@ static WERROR dcesrv_DnssrvOperation2(struct dcesrv_call_state *dce_call, TALLOC
&r->in.pData);
} else {
z = dnsserver_find_zone(dsstate->zones, r->in.pszZone);
if (z == NULL && request_filter == 0) {
/*
* In the case that request_filter is not 0 and z is NULL,
* the request is for a multizone operation, which we do not
* yet support, so just error on NULL zone name.
*/
if (z == NULL) {
return WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST;
}

Expand Down

0 comments on commit d32b96a

Please sign in to comment.