Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Harden launcher: enable CFG/CET, restrict DLL search path, verify ConEmu before launch

Open
#3,117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
cli, security

Research direction

The work is in launcher/src/CmderLauncher.cpp and launcher/CmderLauncher.vcxproj. Start by building the launcher to understand the project structure. Review the specific lines mentioned for the undefined behavior with swprintf_s and the ConEmu launch path. The verification step uses dumpbin to check security flags after building.

Written by the indexing model from the issue text.

Description

Summary

The launcher (launcher/src/CmderLauncher.cpp) is built with the MSVC defaults only, and it starts ConEmu without checking the file first. This issue collects some low-cost hardening. It's a follow-up to #3116.

Proposed changes

  1. Turn on Control Flow Guard and CET shadow stacks. launcher/CmderLauncher.vcxproj sets neither, so both are off. ASLR and DEP are already on by default. Add to the Release configurations:

    • <ControlFlowGuard>Guard</ControlFlowGuard> (compile)
    • <CETCompat>true</CETCompat> (link)
  2. Restrict the DLL search path. Call SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32) at the start of wWinMain, or link with /DEPENDENTLOADFLAG:0x800. That way a DLL planted next to Cmder.exe isn't picked up. This matters most for installs in admin-only locations (e.g. global Scoop or Chocolatey installs).

  3. Check ConEmu before launching it. StartCmder passes vendor\conemu-maximus5\ConEmu64.exe (or ConEmu.exe) to CreateProcess without checking it (CmderLauncher.cpp#L422-L426, #L481). Portable installs are user-writable, so a replaced binary would run under Cmder's name. Options:

    • WinVerifyTrust against the expected publisher, if upstream ConEmu binaries are signed; or
    • compare against a SHA-256 recorded at build time (see #3116).
  4. Stop reading and writing the same buffer in swprintf_s. The ConEmu command line is built with swprintf_s(args, L"%s ...", args, ...) (#L429-L461). Because the source and destination are the same buffer, the result is undefined behaviour. It works with MSVC today, but building the string with std::wstring would be simpler and safe.

Verifying

On a Windows runner, after building:

dumpbin /headers Cmder.exe | Select-String "Dynamic base|NX compatible|High Entropy|Guard|CET"

This could be added as a CI step so the flags don't regress.

Dominant language
PowerShell
Stars
27k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cmderdev/cmder

All issues in cmderdev/cmder

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.