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

Security #10

Open
mvldebian opened this issue Sep 5, 2020 · 1 comment
Open

Security #10

mvldebian opened this issue Sep 5, 2020 · 1 comment
Labels
question Asking questions

Comments

@mvldebian
Copy link
Contributor

How to protect the directory for access without authentication?
If you enter the full URL in the browser even without being authenticated, you can get the file in the temp folder.

Example: https://webmail.example.com.br/plugins/cloudview/temp/1/xxxxxxxxx.xlsx

Any additional configuration in the directory?
I understand that it needs to be public so that Office or Google can upload the file, the problem is to keep these files in the directory accessible.

@jfcherng
Copy link
Member

jfcherng commented Sep 5, 2020

It's logically conflicting. There is no different between the Office/Google agent and an anonymous person.

As long as you are not turning on the "directory listing" feature on your server (apache/nginx etc), I don't think files under the plugins/cloudview/temp/ directory can be "guessed". But there do is a concern that, if the authorized user uses a malware browser, the browser may log/leak the URL.


I force adding an index.html in every directory via

// put an index.html to prevent from potential directory traversal
@\file_put_contents("{$tempDir}/index.html", '', \LOCK_EX);


The filename at this moment is purely md5 hash of the file

private function getAttachmentTempPath(Attachment $attachment): string
{
$fileExt = \strtolower(\pathinfo($attachment->getFilename(), \PATHINFO_EXTENSION));
$fileDotExt = $fileExt ? ".{$fileExt}" : '';
$fileBaseName = \hash('md5', (string) $attachment);
return $this->url("temp/{$this->rcmail->user->ID}/{$fileBaseName}{$fileDotExt}");
}

If it can be guessed, it could possible be that some information of that file had been leaked somewhere else already.

@jfcherng jfcherng added the question Asking questions label Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking questions
Projects
None yet
Development

No branches or pull requests

2 participants