From 47f330f565d742e0283b83ba036ddd6503774e11 Mon Sep 17 00:00:00 2001 From: Elad Shamir <8843083+eladshamir@users.noreply.github.com> Date: Sun, 25 Nov 2018 06:17:20 +0000 Subject: [PATCH] Bug fix for S4U2Proxy requesting a single-part sname --- Rubeus/lib/S4U.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Rubeus/lib/S4U.cs b/Rubeus/lib/S4U.cs index 2620132..05fd419 100755 --- a/Rubeus/lib/S4U.cs +++ b/Rubeus/lib/S4U.cs @@ -83,12 +83,23 @@ namespace Rubeus s4u2proxyReq.req_body.realm = domain; string[] parts = targetSPN.Split('/'); - string serverName = parts[1]; + string serverName = ""; + if (parts.Length > 1) + { + serverName = parts[1]; + } + else + { + serverName = parts[0]; + } s4u2proxyReq.req_body.sname.name_type = 2; // the sname s4u2proxyReq.req_body.sname.name_string.Add(parts[0]); - // the server - s4u2proxyReq.req_body.sname.name_string.Add(serverName); + if (parts.Length > 1) + { + // the server + s4u2proxyReq.req_body.sname.name_string.Add(serverName); + } // supported encryption types s4u2proxyReq.req_body.etypes.Add(Interop.KERB_ETYPE.aes128_cts_hmac_sha1);