Earlier quoted context omitted.
Shell is a bad fit for many uses (an ACME client is more ambitious than I would build in shell, personally), but the things it's good at, it's really good at. I have yet to find anything else that's even close to as good for glue code when I have a handful of tools and/or a bunch of files that I need to string together. Unless you're writing in Ada, I promise whatever language you think is better has its own sharp ed…
I usually replace shell scripts with python (using sh module: https://amoffat.github.io/sh/ for calling other scripts/programs).
Acme.sh runs arbitrary commands from a remote server
41–50 of 71 posts
Re: Acme.sh runs arbitrary commands from a remote server
#42This means that acme.sh has an RCE. Once the patch is in I'm rotating all my certs, even though I use ZeroSSL. I do wonder if what HiCA did gave possibilities to post the private key somewhere else?
Re: Acme.sh runs arbitrary commands from a remote server
#43Earlier quoted context omitted.
I usually replace shell scripts with python (using sh module: https://amoffat.github.io/sh/ for calling other scripts/programs).
Golang is better suited for this, for my needs at least.
Re: Acme.sh runs arbitrary commands from a remote server
#44Sounds about par for the course for folks that think shell is a productively sustainable way of writing secure or reliable software. Not even remotely sorry about that opinion. The gall to claim ACME compat, then force require a single client, all so you can remote execute arbitrary commands. Should be enough to ruin the CA, but we know how people handle things like this "oh, won't affect me " (until it does). Seemin…
But shell is really not hard if people stick to a few easy guidelines:
- quote all var expansion, e.g., "$var" not $var or ${var} (very rare to need otherwise, and never for untrusted data)
- use "$@" to perfectly forward arguments (not $@, not $*, not "$*" except when you want to turn many arguments into one)
- don't use eval
- use `set -eu` and explicitly handle functions/commands that may benignly return/exit non-zero, e.g., `diff -U10 ./a ./b || true`
- use printf on untrusted strings instead of echo (just use it generally, I say), e.g., printf %s\\n "$var" instead of echo "$var". One of the few times you want to use "$*" is with printf though, e.g., printf %s\\n "$*" instead of echo "$@". Try them out, easy to see why, as with one thing to format and multiple arguments, `printf %s\\n "$@"` is equivalent to `for i in "$@" ; do printf %s\\n "$i" ; done`
- when using xargs, use -0 if available, or at least -d\\n if available (busybox doesn't have it for example). also usually want to use -r
Re: Acme.sh runs arbitrary commands from a remote server
#45Re: Acme.sh runs arbitrary commands from a remote server
#46Re: Acme.sh runs arbitrary commands from a remote server
#47Re: Acme.sh runs arbitrary commands from a remote server
#48Sounds about par for the course for folks that think shell is a productively sustainable way of writing secure or reliable software. Not even remotely sorry about that opinion. The gall to claim ACME compat, then force require a single client, all so you can remote execute arbitrary commands. Should be enough to ruin the CA, but we know how people handle things like this "oh, won't affect me " (until it does). Seemin…
- The barrier to entry for shell scripting is tiny. You basically start with `ls` in an interactive shell and end up writing a frickin' 500-line monstrosity within a month.
- POSIX has fossilised scripting languages. I hoped we'd have something like PowerShell by now, but although we have some fine alternatives, none of them seem to be good enough to actually overcome the inertia of POSIX.
- Doing something that looks correct is easy, but doing the right thing is super effing hard. See looping through complex sets of files.
- People use statements like "It's just a script", as if scripts are somehow easy to write. Bullshit.
Re: Acme.sh runs arbitrary commands from a remote server
#49Earlier quoted context omitted.
Can you elaborate?
Python scripts will often break with system upgrades, most acutely when Python2 went away, but under many other circumstances as well.
Of course, as I write this ansible is broken on one of my machines for reasons that appear to stem from a python 3.x->3.y update, so...
Re: Acme.sh runs arbitrary commands from a remote server
#50Major props and thanks to the HiCA person for engaging on the thread even though they were getting hammered. Yes they made some really (damn clever but) bad implementation decisions to use an RCE in the client to basically hack around the entire system, and then compounded it with other bad decisions to redirect to the US White House website to stop a DDoS, but the fact that they engaged, admitted, and explained what…