{"id":3490,"date":"2018-10-10T16:06:18","date_gmt":"2018-10-10T21:06:18","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=3490"},"modified":"2020-04-29T22:54:14","modified_gmt":"2020-04-30T03:54:14","slug":"debugging-an-active-directory-custom-password-filter","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=3490","title":{"rendered":"Debugging An Active Directory Custom Password Filter"},"content":{"rendered":"<p>A few years ago, I implemented a <a href=\"http:\/\/lisa.rushworth.us\/?p=682\">custom password filter<\/a> in Active Directory. At some point, it began accepting passwords that should be rejected. The updated code is available at <a href=\"https:\/\/github.com\/ljr55555\/OpenPasswordFilter\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/ljr55555\/OpenPasswordFilter<\/a> and the following is the approach I used to isolate the cause of the failure.<\/p>\n<p>&nbsp;<\/p>\n<p><strong><em>Technique #1<\/em><\/strong> &#8212; Netcap on the loopback There are utilities that allow you to capture network traffic across the loopback interface. This is helpful in isolating problems in the service binary or inter-process communication. I used <a href=\"https:\/\/www.netresec.com\/?page=RawCap\" target=\"_blank\" rel=\"noopener noreferrer\">RawCap<\/a> because it&#8217;s free for commercial use. There are <a href=\"https:\/\/wiki.wireshark.org\/CaptureSetup\/Loopback\" target=\"_blank\" rel=\"noopener noreferrer\">other approaches<\/a> too &#8211; or consult the search engine of your choice.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3491\" rel=\"attachment wp-att-3491\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3491\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging01.png\" alt=\"\" width=\"683\" height=\"327\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging01.png 683w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging01-300x144.png 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/a><\/p>\n<p>The capture file can be opened in Wireshark. The communication is done in clear text (which is why I bound the service to localhost), so you\u2019ll see the password:<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3492\" rel=\"attachment wp-att-3492\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3492\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging02.png\" alt=\"\" width=\"765\" height=\"602\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging02.png 765w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging02-300x236.png 300w\" sizes=\"auto, (max-width: 765px) 100vw, 765px\" \/><\/a><\/p>\n<p>And response<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3493\" rel=\"attachment wp-att-3493\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3493\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging03.png\" alt=\"\" width=\"815\" height=\"331\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging03.png 815w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging03-300x122.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging03-768x312.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>To ensure process integrity, the full communication is for the client to send \u201ctest\\n\u201d <em>then<\/em> \u201cPasswordToTest\\n\u201d, after which the server sends back either true or false.<\/p>\n<p><strong><em>Technique #2<\/em><\/strong> &#8212; Debuggers Attaching a debugger to lsass.exe is not fun. Use a remote debugger &#8212; until you tell the debugger to proceed, the OS is pretty much useless. And if the OS is waiting on you to click something running locally, you are quite out of luck. A remote debugger allows you to use a functional operating system to tell the debugger to proceed, at which time the system being debugged returns to service.<\/p>\n<p>Install the SDK debugging utilities on your domain controller and another box. <em>Which<\/em> SDK debugging tool? That\u2019s going to depend on your OS. For Windows 10 and Windows Server 2012 R2, the Windows 10 SDK (Debugging Tools For Windows 10) work. <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/debugger-download-tools\">https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/debugger-download-tools<\/a> or Google it.<\/p>\n<p>On the domain controller, find the PID of LSASS and write it down (472 in my example). Check the IP address of the domain controller (10.104.164.110 in my example).<\/p>\n<p>From the domain controller, run:<\/p>\n<p>dbgsrv.exe -t tcp:port=11235,password=s0m3passw0rd<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3494\" rel=\"attachment wp-att-3494\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3494\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging04.png\" alt=\"\" width=\"683\" height=\"351\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging04.png 683w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging04-300x154.png 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/a><\/p>\n<p>Where port=11235 can be any un-used port and password=s0m3passw0rd can be whatever string you want \u2026 you\u2019ve just got to use the same values when you connect from the client. Hit enter and you\u2019ve got a debugging server. It won\u2019t look like it did anything, but you\u2019ll see the port bound on netstat<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3495\" rel=\"attachment wp-att-3495\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3495\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging05.png\" alt=\"\" width=\"683\" height=\"327\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging05.png 683w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging05-300x144.png 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/a><\/p>\n<p>And the binary running in taskman<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3496\" rel=\"attachment wp-att-3496\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3496\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging06.png\" alt=\"\" width=\"825\" height=\"750\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging06.png 825w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging06-300x273.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging06-768x698.png 768w\" sizes=\"auto, (max-width: 825px) 100vw, 825px\" \/><\/a><\/p>\n<p>From the other box, run the following command (substituting the correct server IP, port, password, and process ID):<\/p>\n<p>windbg.exe -y &#8220;srv:c:\\symbols_pub*<a href=\"http:\/\/msdl.microsoft.com\/downloads\/symbols\">http:\/\/msdl.microsoft.com\/downloads\/symbols<\/a>&#8221; -premote tcp:server=10.104.164.110,port=11235,password=s0m3passw0rd -p 472<\/p>\n<p>This attaches your WinDBG to the debugging server &amp; includes an internet-hosted symbol path. Don\u2019t worry when it says \u201cDebugee not connected\u201d at the bottom \u2013 that just means the connection has not completed. If it didn\u2019t connect at all (firewall, bad port number, bad password), you\u2019d get a pop-up error indicating that the initial connection failed.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3497\" rel=\"attachment wp-att-3497\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3497\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging07.png\" alt=\"\" width=\"684\" height=\"392\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging07.png 684w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging07-300x172.png 300w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/a><\/p>\n<p>Wait for it &#8230; this may take a long time to load up, during which time your DC is vegged. But eventually, you&#8217;ll be connected. Don\u2019t try to use the DC yet \u2013 it will just seem hung, and <em>trying <\/em>to get things working just make it worse. Once the debugger is connected, send &#8216;g&#8217; to the debugger to commence \u2013 and now the DC is working again.<\/p>\n<p>Down at the bottom of the command window, there\u2019s a status (0:035&gt; below) followed by a field where you enter commands. Type the letter <strong>g<\/strong> in there &amp; hit enter.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3498\" rel=\"attachment wp-att-3498\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3498\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging08-1024x550.png\" alt=\"\" width=\"960\" height=\"516\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging08-1024x550.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging08-300x161.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging08-768x412.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging08.png 1520w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>The status will then say \u201cDebuggee is running \u2026\u201d and you\u2019re server is again responsive to user requests.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3499\" rel=\"attachment wp-att-3499\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3499\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging09-1024x550.png\" alt=\"\" width=\"960\" height=\"516\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging09-1024x550.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging09-300x161.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging09-768x412.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging09.png 1520w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>When you reach a failing test, pause the debugger with a break command (Debug=&gt;Break, or Ctrl-Break) which will veg out the DC again. You can view the call stack, memory, etc.<\/p>\n<p>To search the address space for an ASCII string use:<\/p>\n<pre>!for_each_module s -[1]a ${@#Base} L?${@#Size}\u00a0 \"bobbob\"<\/pre>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3500\" rel=\"attachment wp-att-3500\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3500\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging10-1024x550.png\" alt=\"\" width=\"960\" height=\"516\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging10-1024x550.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging10-300x161.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging10-768x412.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging10.png 1520w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>Where \u201cbobbob\u201d is the password I had tested.<\/p>\n<p>Alternately, run the \u201cpsychodebug\u201d build where LARGEADDRESSAWARE is set to NO and you can search <em>just<\/em> the low 2-gig memory space (32-bit process memory space):<\/p>\n<pre>s -a 0 L?80000000 \"bobbob\"<\/pre>\n<p>* The true\/false server response is an ASCII string, not a Boolean. *<\/p>\n<p>Once you have found what you are looking for, \u201cgo\u201d the debugger (F5, Debug=&gt;Go, or \u00a0\u2018g\u2019) to restore the server to an operational state. Break again when you want to look at something.<\/p>\n<p>To disconnect, break and send \u201cqd\u201d to the debugger (quit and detach). If you do not detach with qd, the process being debugged terminates. Having lsass.exe terminate really freaks out the server, and it will go into an auto-recovery \u201cI\u2019m going to reboot in one minute\u201d mode. It\u2019ll come back, but detaching without terminating the process is a lot nicer.<\/p>\n<p><strong><em>Technique #3<\/em><\/strong> \u2013 Compile a verbose version. I added a number of event log writes within the DLL (obviously, it&#8217;s not a good idea in production to log out candidate passwords in clear text!). While using the debugger will get you there eventually, half an hour worth of searching for each event (the timing is tricky so the failed event is still in memory when you break the debugger) \u2026 having each iteration write what it was doing to the event log was FAAAAAR simpler.<\/p>\n<p>And since I\u2019m running this on a dev DC where the passwords coming across are all generated from a load sim script \u2026 not exactly super-secret stuff hitting the event log.<\/p>\n<p>Right now, I\u2019ve got an incredibly verbose DLL on APP556 under d:\\tempcsg\\ljr\\2\\debugbuild\\psychodebug\\ \u2026 all of the commented out event log writes from <a href=\"https:\/\/github.com\/ljr55555\/OpenPasswordFilter\">https:\/\/github.com\/ljr55555\/OpenPasswordFilter<\/a> <em>aren\u2019t<\/em> commented out.<\/p>\n<p>Stop the OpenPasswordFilter service, put the verbose DLL and executables in place, and reboot. Change some passwords, then look in the event viewer.<\/p>\n<p>ERROR events are actual problems that would show up either way. INFORMATION events are extras. I haven\u2019t bothered to learn how to properly register event sources in Windows yet \ud83d\ude42 You can find the error content at the bottom of the &#8220;this isn&#8217;t registered&#8221; complaint:<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3501\" rel=\"attachment wp-att-3501\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3501\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging11.png\" alt=\"\" width=\"800\" height=\"556\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging11.png 800w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging11-300x209.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging11-768x534.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>You will see events for the following steps:<\/p>\n<p style=\"padding-left: 30px;\">DLL starting CreateSocket<\/p>\n<p style=\"padding-left: 30px;\">About to test password 123paetec123-Dictionary-1-2<\/p>\n<p style=\"padding-left: 30px;\">Finished sendall function to test password123paetec123-Dictionary-1-2<\/p>\n<p style=\"padding-left: 30px;\">Got t on test of paetec123-Dictionary-1-2<\/p>\n<p>The final line will either say \u201cGot t\u201d for true or \u201cGot f\u201d for false.<\/p>\n<p><strong><em>Technique #4<\/em><\/strong> \u2013 Running the code <em>through<\/em> the debugger. Whilst there\u2019s no good way to get the \u201cNotification Package\u201d hook to run the DLL through the debugger, you can install Visual Studio on a dev domain controller and execute the service binary through the debugger. This allows you to set breakpoints and watch variable values as the program executes \u2013 which makes it a whole lot easier than using WinDBG to debug the production code.<\/p>\n<p>Grab a copy of the source code \u2013 we\u2019re going to be making some changes that should not be promoted to production, so I work on a temporary copy of the project and delete the copy once testing has completed.<\/p>\n<p>Open the project in Visual Studio. Right-click OPFService in the \u201cSolution Explorer\u201d and select \u201cProperties\u201d<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3502\" rel=\"attachment wp-att-3502\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3502\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging12.png\" alt=\"\" width=\"687\" height=\"781\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging12.png 687w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging12-264x300.png 264w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><\/a><\/p>\n<p>Change the build configuration to \u201cDebug\u201d<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3503\" rel=\"attachment wp-att-3503\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3503\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging13.png\" alt=\"\" width=\"605\" height=\"193\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging13.png 605w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging13-300x96.png 300w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/a><\/p>\n<p>Un-check \u201cOptimize code\u201d \u2013 code optimization is good for production run, but it will wipe out variable values when you want to see them.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3504\" rel=\"attachment wp-att-3504\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3504\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging14.png\" alt=\"\" width=\"974\" height=\"547\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging14.png 974w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging14-300x168.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging14-768x431.png 768w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/a><\/p>\n<p>Set a breakpoint on execution \u2013 on the OPFDictionary.cs file, the loop checking to see if the proposed word is contained in the banned word list is a good breakpoint. The return statements are another good breakpoint as it pauses program execution <em>right<\/em> before a password test iteration has completed.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3505\" rel=\"attachment wp-att-3505\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3505\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging15.png\" alt=\"\" width=\"763\" height=\"318\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging15.png 763w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging15-300x125.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/a><\/p>\n<p>Build the solution (Build=&gt;Build Solution). Stop the Windows OpenPasswordFilter service.<\/p>\n<p>Launch the service binary through the debugger (Debug=&gt;Start Debugging).<\/p>\n<p>Because the program is being run interactively instead of through a service, you\u2019ll get a command window that says \u201cPress any key to stop the program\u201d. Minimize this.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3506\" rel=\"attachment wp-att-3506\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3506\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging16-1024x215.png\" alt=\"\" width=\"960\" height=\"202\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging16-1024x215.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging16-300x63.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging16-768x162.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging16.png 1103w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>From a <em>new<\/em> command prompt, telnet to localhost on port 5995 (the telnet client is not installed by default, so you may need to use \u201cTurn Windows features on or off\u201d and enable the telnet client first).<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3507\" rel=\"attachment wp-att-3507\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3507\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging17-1024x303.png\" alt=\"\" width=\"960\" height=\"284\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging17-1024x303.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging17-300x89.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging17-768x227.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging17.png 1103w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>Once the connection is established, use CTRL and ] to get into the telnet command prompt. Type <strong>set localecho<\/strong> \u2026 now you\u2019ll be able to see what you are typing.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3508\" rel=\"attachment wp-att-3508\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3508\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging18-1024x303.png\" alt=\"\" width=\"960\" height=\"284\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging18-1024x303.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging18-300x89.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging18-768x227.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging18.png 1103w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>Hit enter again and you\u2019ll return to the blank window that is your telnet client. Type <strong>test<\/strong> and hit enter. Then type a candidate password and hit enter.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3509\" rel=\"attachment wp-att-3509\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3509\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging19.png\" alt=\"\" width=\"749\" height=\"231\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging19.png 749w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging19-300x93.png 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/a><\/p>\n<p>Program execution will pause at the breakpoint you\u2019ve set. Return to Visual Studio. Select Debug =&gt;Window=&gt;Locals to open a view of the variable values<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3511\" rel=\"attachment wp-att-3511\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3511\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging20.png\" alt=\"\" width=\"793\" height=\"417\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging20.png 793w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging20-300x158.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging20-768x404.png 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/a><\/p>\n<p>View the locals at the breakpoint, then hit F5 if you want to continue.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3512\" rel=\"attachment wp-att-3512\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3512\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging21.png\" alt=\"\" width=\"778\" height=\"209\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging21.png 778w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging21-300x81.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging21-768x206.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/a><\/p>\n<p>If you\u2019re set breakpoints on either of the return statements, program execution will also pause before the return \u2026 which gives you an opportunity to see which return is being used &amp; compare the variable values again.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3513\" rel=\"attachment wp-att-3513\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3513\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging22.png\" alt=\"\" width=\"962\" height=\"441\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging22.png 962w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging22-300x138.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging22-768x352.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/a><\/p>\n<p>In this case, I submitted a password that <em>was<\/em> in the banned word list, so the program rightly evaluated line 56 to true and returns true.<\/p>\n<p><a href=\"http:\/\/lisa.rushworth.us\/?attachment_id=3510\" rel=\"attachment wp-att-3510\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3510\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/10\/OPFDebugging19b.png\" alt=\"\" width=\"749\" height=\"231\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging19b.png 749w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/10\/OPFDebugging19b-300x93.png 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/a><\/p>\n<!-- Begin PayPal Donations by https:\/\/www.tipsandtricks-hq.com\/paypal-donations-widgets-plugin -->\n\n<form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_blank\">\n    <div class=\"paypal-donations\">\n        <input type=\"hidden\" name=\"cmd\" value=\"_donations\" \/>\n        <input type=\"hidden\" name=\"bn\" value=\"TipsandTricks_SP\" \/>\n        <input type=\"hidden\" name=\"business\" value=\"paypal@lisa.rushworth.us\" \/>\n        <input type=\"hidden\" name=\"return\" value=\"https:\/\/www.rushworth.us\/lisa\/thanks.php\" \/>\n        <input type=\"hidden\" name=\"item_name\" value=\"Donation\" \/>\n        <input type=\"hidden\" name=\"item_number\" value=\"PassFilterDebugging\" \/>\n        <input type=\"hidden\" name=\"rm\" value=\"0\" \/>\n        <input type=\"hidden\" name=\"currency_code\" value=\"USD\" \/>\n        <input type=\"image\" style=\"cursor: pointer;\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/btn\/btn_donateCC_LG.gif\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online.\" \/>\n        <img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\" \/>\n    <\/div>\n<\/form>\n<!-- End PayPal Donations -->\n\n","protected":false},"excerpt":{"rendered":"<p>A few years ago, I implemented a custom password filter in Active Directory. At some point, it began accepting passwords that should be rejected. The updated code is available at https:\/\/github.com\/ljr55555\/OpenPasswordFilter and the following is the approach I used to isolate the cause of the failure. &nbsp; Technique #1 &#8212; Netcap on the loopback There &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[68,366,365,672,32],"class_list":["post-3490","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-active-directory","tag-ad-password-filter","tag-custom-password-filter","tag-password-filter","tag-technology"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3490"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3490\/revisions"}],"predecessor-version":[{"id":6350,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3490\/revisions\/6350"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}