GithubHelp home page GithubHelp logo

Comments (7)

dfandrich avatar dfandrich commented on May 13, 2024 2

from curl.

bagder avatar bagder commented on May 13, 2024 1

This is by design, not a bug. We are not prepared to cause breakage to countless scripts in the world. We recommend you switch default proto or disable plain http in your .curlrc or similar.

I would welcome a deeper discussion on how, or when, this kind of change could be done, but that's a discussion. Not an issue.

from curl.

dfandrich avatar dfandrich commented on May 13, 2024

from curl.

sh1boot avatar sh1boot commented on May 13, 2024

How about a user or site configuration option to change the default, so that people can at least volunteer to suffer the pain of broken scripts in the name of security? Or even a build option to be used by security-above-all-else distributions.

I think any site worth getting data from will give the same response on https anyway. Actually needing http seems kind of niche, and worth being explicit about.

from curl.

sh1boot avatar sh1boot commented on May 13, 2024

Well, when I say 'add an option' I don't mean an option for the diligent user (those users will, as you say, fix the URL by hand), but something to curb dangerous defaults. Your example ~/.curlrc entries are helpful, but they also break some normal and deliberate behaviour.

What I'm thinking is configuration around this block of code:

curl/lib/urlapi.c

Lines 1204 to 1220 in 5691a6c

if((flags & CURLU_GUESS_SCHEME) && !schemep) {
const char *hostname = Curl_dyn_ptr(&host);
/* legacy curl-style guess based on host name */
if(checkprefix("ftp.", hostname))
schemep = "ftp";
else if(checkprefix("dict.", hostname))
schemep = "dict";
else if(checkprefix("ldap.", hostname))
schemep = "ldap";
else if(checkprefix("imap.", hostname))
schemep = "imap";
else if(checkprefix("smtp.", hostname))
schemep = "smtp";
else if(checkprefix("pop3.", hostname))
schemep = "pop3";
else
schemep = "http";

to make the default guesses the secure choices -- while still allowing guessing and still allowing deliberate use of http as appropriate.

That's the minimal-disruption solution I imagine which would allow safety-conscious distributions and site administrators to force-enable at build time, if they judge that the consequential pain (where people have to add http:// to some scripts if that's what they need) is worthwhile for broader security for their users.

As things stand, people out there on the internet still post bash <(curl -L trustworthy-site.com) commands for others to paste into their terminal, overlooking that while they may trust the site, curl's default behaviour opens this up to downgrade attacks and the code they run may well turn out to be malicious.

Even if it's off by default just having the option is an important first step. Having the option raises awareness.

from curl.

jay avatar jay commented on May 13, 2024

I don't agree that it is dangerous. If you don't select a secure protocol then that's what happens. I like Dan's suggestion to use --proto-default in curlrc to force it to https.

from curl.

sh1boot avatar sh1boot commented on May 13, 2024

I mean.... somewhere low down on the first page of search results for 'curl pipe bash' I find this: https://www.arp242.net/curl-to-sh.html

Man-in-the-middle attacks: this is only a problem “if the developers omit the usage of TLS”, as the article already mentions. This is increasingly rare, and all of the cited examples use TLS.

They say that omission of TLS is "increasingly rare", but the syntax they give in their own example is: curl example.com/install.sh | sh which omits TLS because of the way curl behaves.

"Working the way you should have expected" is not the same as safe.

Just saying... 🤷

from curl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.