The pattern
The server wants to ping a host. It builds a shell string. Your input is supposed to be a hostname. If metacharacters are not stripped, the shell sees extra commands.
Code
bashping -c 1 USER_HOSTLab signals
- Output looks like raw terminal text in the HTML page.
- Timing changes when you add a sleep-style separator in the lab.
- Error messages mention /bin/sh or ping: unknown host plus extra text.
Do not copy-paste into prod
This post is a lab teaching aid. Do not run injection tests on networks or appliances you do not own.
How engineers actually fix it
Do not call a shell. Use a library or exec with an argument array. Allow-list hostnames. Drop privileges. Log the diagnostic, do not echo it blindly.
Expected lab output
$ PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64