← Back to search

Bypass Whitespace Filters in Command Injection

exploitationtool

Summary

Techniques to inject commands when spaces are filtered, using Bash brace expansion or the ${IFS} variable in place of whitespace.

Walkthrough

When a command-injection filter blocks spaces, substitute them so the shell still parses separate arguments.

Techniques

  • Brace expansion — Bash splits a comma-separated list into separate words, removing the need for spaces:

``bash {ping,-c,<IP>} ``

  • `${IFS}` variable — the Internal Field Separator expands to whitespace, so it works wherever a space is needed:

``bash ping${IFS}-c${IFS}1 ``

Commands

bash

{ping,-c,<IP>}

bash

ping${IFS}-c${IFS}1