Skip to content

Commit

Permalink
rtsp-auth: Fix NULL pointer dereference when handling an invalid basi…
Browse files Browse the repository at this point in the history
…c Authorization header

When using the basic authentication scheme, we wouldn't validate that
the authorization field of the credentials is not NULL and pass it on
to g_hash_table_lookup(). g_str_hash() however is not NULL-safe and will
dereference the NULL pointer and crash.
A specially crafted (read: invalid) RTSP header can cause this to
happen.

As a solution, check for the authorization to be not NULL before
continuing processing it and if it is simply fail authentication.

This fixes CVE-2020-6095 and TALOS-2020-1018.

Discovered by Peter Wang of Cisco ASIG.
  • Loading branch information
sdroege committed Mar 23, 2020
1 parent daa18dc commit 44ccca3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gst/rtsp-server/rtsp-auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ default_authenticate (GstRTSPAuth * auth, GstRTSPContext * ctx)

GST_DEBUG_OBJECT (auth, "check Basic auth");
g_mutex_lock (&priv->lock);
if ((token =
if ((*credential)->authorization && (token =
g_hash_table_lookup (priv->basic,
(*credential)->authorization))) {
GST_DEBUG_OBJECT (auth, "setting token %p", token);
Expand Down

0 comments on commit 44ccca3

Please sign in to comment.