Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOCTOU attacks issue #10

Open
shogo82148 opened this issue Jan 7, 2017 · 2 comments
Open

TOCTOU attacks issue #10

shogo82148 opened this issue Jan 7, 2017 · 2 comments

Comments

@shogo82148
Copy link
Contributor

yoya-thumber prohibits loopback address, but it seems that there is Time Of Check to Time Of Use (TOCTOU) attacks issue.

In yoya-thumber/thumberd/thumberd.go

	u, err = url.Parse(imageUrl)

        // CHECK
	// these codes are referencing net/http/transport.go useProxy method.
	if err != nil {
		return nil, err
	}
	if u.Host == "localhost" {
		return nil, errors.New("localhost is prohibited.")
	}
	if ip := net.ParseIP(u.Host); ip != nil {
		if ip.IsLoopback() {
			return nil, errors.New("loopback address is prohibited.")
		}
	}

        // Attacker may change DNS record

        // USE
	req, err := http.NewRequest("GET", imageUrl, nil)

SEE ALSO

@tkng
Copy link
Contributor

tkng commented Jan 8, 2017

Hi, thanks to notify this issue.

Using paranoidhttp is apparently better solution, I'll try it.

@tkng
Copy link
Contributor

tkng commented Jan 26, 2017

I tried to replace yota-thumber's http client with paranoidhttp, but aborted. Paranoidhttp doesn't support IPv6. I couldn't estimate the extent of the impact when we dropped IPv6 support.

There are several possible solutions.

  1. Investigate the rate of "IPv6 only" site from log files. If it is low enough, then we'll be able to replace the http client with paranoidhttp.
  2. Make a pull request to support IPv6 to paranoidhttp.

I think that it's better to choose the 2nd option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants