Giter Club home page Giter Club logo

encryption-helper's People

Contributors

dragonrun1 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

encryption-helper's Issues

Multiple Cryptographic Issues

  • if ($checksum === null || $checksum !== $this->computedCheckSum()) {
  • /**
    * Used to create and validate query checksum value.
    *
    * @return string
    */
    private function computedCheckSum(): string
    {
    $checksum = 0;
    $zero = ord('0');
    $func = function ($acc = 0, $value) use ($zero) {
    foreach (str_split($value) as $item) {
    $acc += ord($item) - $zero;
    }
    return $acc;
    };
    $checksum += array_reduce(array_keys($this->queries), $func);
    $checksum += array_reduce($this->queries, $func);
    return sprintf('%X', $checksum);
    }
    • This checksum is not a secure message authenticator (e.g. HMAC-SHA256, Poly1305), particularly because it doesn't have any secret keys.
  • private $cipher = 'DES-CBC';
  • $decrypted = openssl_decrypt($this->getBytes($data), $this->cipher, $this->getKey(),
    OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $this->getInitVector());

When you combine these snippets together, you get a situation that looks like this:

  1. You're encrypting by default with DES, which can be brute-forced in a day's time.
  2. You're using unauthenticated encryption.
  3. You're using it to encrypt URL parameters, which is a questionable solution to begin with.

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.