Live data from Hacker News

TIL: You can make HTTP requests without curl using Bash /dev/TCP

mareksuppa.com

191–200 of 255 posts

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#191
post #44
post #37

Earlier quoted context omitted.

what would be a non-pilled way of saying the same thing?

Yeah. The comments saying it's AI-pilled comments are more annoying and less informative than the comments themselves.

Agreed. I really wish Dang would explicitly add that to the rules.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#192

As a kid in the late 90s my mind was blown when I realized I could telnet to port 80, 25, or 110 and interact with the servers manually. Simple get: GET / HTTP/1.1 Content-Type: text/html User-Agent: l33t hax0rs lol X-Funny-Monkey: farts For sending a mail message on port 25: HELO mail-from: whoever@whatever.com mail-to: sysadmin@yaya.com Body of the message yay. POP3 was so long ago I forgot but you could list the m…

Isn't that the whole point of TCP? Creating a pair of two streams you can read out of and write to out of less reliable network primitives? I am not sure why this is a revelation. Any college level networking course would cover this?!

> Any college level networking course would cover this?!

As an actual kid it's easy for it to be a revelation, no? At least it was for me, with no college level networking course experience.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#193
Oh man this would have saved me quite some time trying to include curl in my initramfs image with busybox that fires off a request to notify me to login via dropbear to put in the LUKS key. In the end the copy_exec script worked well though and i do have https

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#195
post #19

Earlier quoted context omitted.

More than one ~500 employee company I've worked at has had security policies either encouraging or requiring the use of "distro-less" images - images with no OS components other than the absolute minimum required to run the application. For go binaries this meant literally nothing in the container apart from the executable. In theory it has a couple of benefits. You don't have to re-deploy your image to patch CVE's i…

> not having standard debugging tools available where and when we need them Keeping in mind that containers are merely a bunch of namespaces, there's nothing stopping you from entering the same PID namespace with a different mount namespace in order to debug.

I am aware, thank you :). I responded to a sibling dupe-comment over here [1].

To summarize, in my experience there is immense value to having basic shell tools available in the environment where you need them with zero extra friction. Stripping those out provides a security benefit only in specific nebulous and niche scenarios.

1: https://news.ycombinator.com/item?id=48561605

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#196
post #64

Earlier quoted context omitted.

> FROM scratch just reduces the surface. The actual attack surface of your application? Or the attack surface of you and your team's attention from a busybody security org. It's important not to confuse the two.

Both. Many attacks take the form of an exploit to get a shell, then using available utilities to exploit the kernel to escape to the host. If your image has neither a shell nor utilities that won't get very far.

What percentage of CVEs can be used to obtain a shell, but can't otherwise be used to obtain some other form of code execution in a distro-less container?

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#197

Earlier quoted context omitted.

Isn't that the whole point of TCP? Creating a pair of two streams you can read out of and write to out of less reliable network primitives? I am not sure why this is a revelation. Any college level networking course would cover this?!

> Any college level networking course would cover this?! As an actual kid it's easy for it to be a revelation, no? At least it was for me, with no college level networking course experience.

Sorry my brain somehow missed the literal first three words of the oc.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#200
post #196

Earlier quoted context omitted.

Both. Many attacks take the form of an exploit to get a shell, then using available utilities to exploit the kernel to escape to the host. If your image has neither a shell nor utilities that won't get very far.

What percentage of CVEs can be used to obtain a shell, but can't otherwise be used to obtain some other form of code execution in a distro-less container?

I haven't run any stats and am certainly not an expert but I would expect quite a few. In the one scenario you merely need to pull off an exec with a valid path. In the other you need to either write a block of memory and mark it as executable or else write your payload out to disk and mark the file executable. So it's the difference between being able to pull off a single syscall versus most likely needing arbitrary code execution.
Post reply on HN