Adrian L Thomas

Pizza, programming and cars - sometimes in that order.

Running curl in BusyBox

December 24, 2021

curl doesn’t exist in BusyBox by default, but there is a way to do it - and it’s simpler than you may think!

BusyBox is an executable that typically gets used in low powered devices like routers, it gives you basic commands like cd or ls but if you want to curl something from the internet (e.g. HTTP POST): you can’t. There’s no package manager, and it’s very awkward to do manually with netcat / raw TCP.

You do have wget, but it doesn’t provide HTTP POST behaviour, but it does let you HTTP GET… a pre-built curl binary!

First, find out what CPU architecture you’re on:

$ arch
x86_64

Here we’re running 64bit x86, but you may be running ARM or some other architecture. Head to curl.se and pick the binary for your flavour. It’ll take you to the GitHub page to download it: copy the URL for your binary.

Then simply wget the url! don’t forget to make it executable

wget https://github.com/moparisthebest/static-curl/releases/download/v7.80.0/curl-amd64
chmod +x ./curl-amd64
./curl-amd64 -X POST --insecure https://ptsv2.com/t/57y8r-1640280329/post

Note: As CA certificates aren’t installed either, I needed to pass the --insecure flag. Ideally you should make them available to BusyBox.