Code Monkey home page Code Monkey logo

Comments (8)

mitchhankins01 avatar mitchhankins01 commented on September 27, 2024 1

Hi @williamdes, thank you for your response.
We are unable to modify the library (or eliminate the unused function) because it is used in our proprietary software.
A new release with the function taken out would be greatly appreciated!

from tcpdf.

kmurph92 avatar kmurph92 commented on September 27, 2024 1

Thanks for your reply williamdes. We believe the following call (and ones like it) may be used to expose sensitive information from the file system:

TCPDF_STATIC::fileGetContents('../../../etc/passwd');

If you disagree with our belief, please let us know why the behavior I described isn't possible.

For reference, you can find information about path traversal vulnerabilities, including attack examples and mitigation strategies at OWASP website here: https://owasp.org/www-community/attacks/Path_Traversal

Thanks Again.

from tcpdf.

d-javu avatar d-javu commented on September 27, 2024 1

The LGPL argument is a strange one. Do the work, send your changes upstream. Just as for any other open source software.

The mentioned function is used by the file content cache:

TCPDF/tcpdf.php

Lines 24765 to 24771 in d4adef4

protected function getCachedFileContents($file)
{
if (!isset($this->fileContentCache[$file])) {
$this->fileContentCache[$file] = TCPDF_STATIC::fileGetContents($file);
}
return $this->fileContentCache[$file];
}

It is called from:

_putEmbeddedFiles()
getHtmlDomArray($html)
Image($file, ...)
ImageEps($file, ...)
ImageSVG($file, ...)

I've not investigated thoroughly, but it looks difficult to get data out of /random/secret/file using these functions.

from tcpdf.

mitchhankins01 avatar mitchhankins01 commented on September 27, 2024 1

We have discovered that the "HOST" header of an HTTP request is immutable by the end user. The host will be whatever the domain name is that the HTTP request is being sent to. The TCPDF_STATIC::fileGetContents function is not subject to any mutable HTTP header information and therefore, this can be classified as a false positive.

from tcpdf.

williamdes avatar williamdes commented on September 27, 2024

We are unable to modify the library due to the LGPL license.

I do not understand why this is an issue, can you elaborate ?

The function seems not used by the code as far as my research confirms it.
See: https://github.com/search?q=repo%3Atecnickcom%2FTCPDF%20fileGetContents&type=code
Ref:

public static function fileGetContents($file) {

@nicolaasuni what about deleting it and some more stuff like tcpdf import and releasing a major version ?

from tcpdf.

kmurph92 avatar kmurph92 commented on September 27, 2024

If removal of the offending function is not possible or undesirable, I recommend considering the use of the realpath and basename functions to prevent possible path traversal.

If you believe that path traversal is not possible within this function, can you please let us know why it is not possible?

Thanks!

from tcpdf.

williamdes avatar williamdes commented on September 27, 2024

Well, I will let @nicolaasuni take the decisions needed or not. I am only a contributor to this project.
For me this is a theoretical security issue. If you can provide proof of a real one I may work on a fix

from tcpdf.

kmurph92 avatar kmurph92 commented on September 27, 2024

Thanks d-javu. We will plan to submit a pull request soon.

from tcpdf.

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.