6,663 karma · joined Feb 25, 2016 (10y ago) · 1,775 submissions
Previously AWS Cryptography (2019 - 2023).
Unless otherwise stated, my opinions are my own and do not reflect my employer.
https://scottarc.blog/about/
comment 10y ago · link · parent
comment 10y ago · link · parent
Y'know how people say, "Don't reinvent the wheel?" The emphasis should be on the.
Don't reinvent THE wheel.
Feel free to invent a better wheel.
Better here can mean simpler, which allows users to be more productive. As far as I can tell, you've accomplished this much. So, good job, and thanks for sharing.
1446.
Setting Up Caddy for PHP 7 on Debian Jessie (Automatic HTTPS)(paragonie.com ↗)
1 points · by CiPHPerCoder · 10y ago · discuss
comment 10y ago · link · parent
I also wrote https://github.com/paragonie/halite which is a PHP library aims to make libsodium incredibly easy for PHP developers to get right.
For systems that need asymmetric crypto and can't install libsodium, I also wrote https://github.com/paragonie/EasyRSA which side-steps a lot of the mistakes developers make. EasyRSA uses defuse for symmetric-key encryption, then encrypts the AES key with RSA.
Writing secure cryptography isn't trivial. Assuming the three projects I just linked to are secure enough to use (all indications point to: they are), there's literally no reason to reinvent the wheel solely for Magento.
Magento already uses Composer; they could just add them to their composer.json file and rewrite their routines to use defuse + maybe EasyRSA if they have a use case for it.
Zend\Crypt is also an acceptable choice, as long as you don't install the version with an RSA implementation vulnerable to padding oracle attacks. https://framework.zend.com/security/advisory/ZF2015-10
comment 10y ago · link · parent
comment 10y ago · link · parent
https://paragonie.com/blog/2016/04/securely-implementing-de-...
comment 10y ago · link · parent
My reason for this belief is that, in my experience, it engenders tunnel vision and what I appropriately refer to as a "checklist mentality". There are developers who believe, "We're immune to the items on the OWASP Top 10, so we're secure," when there are entire classes of vulnerabilities that applications can be vulnerable to (say: using a weak and predictable PRNG for their password reset tokens) that isn't adequately described by the OWASP Top 10.
An alternative approach that I feel is more helpful is to organize insecurity into a taxonomy.
* Code/data confusion
* SQL Injection
* Local/Remote File Inclusion
* Cross-Site Scripting (XSS)
* LDAP Injection
* XPath Injection
* Several memory corruption vulnerabilities
* Logic Errors
* Confused deputies
* CSRF
* Failure to enforce access controls
* Operating Environment
* Using software with known vulnerabilities
* Using HTTP instead of HTTPS
* Cryptography flaws
* Yes, this deserves a category of its own
* Chosen-plaintext attacks
* Chosen-ciphertext attacks
* Side-channel cryptanalysis
* Hash collision vulnerabilities (e.g. length-extension)
* Weak/predictable random values
You can further break down into more specific instances.There are three types of XSS (stored, reflective, DOM-based). There are blind SQL injection techniques worth studying too. But the underlying problem that makes these vulnerabilities possible is simple: User-provided data is being treated as code. Any technology that prevents this confusion will greatly improve security.
For example: SQL injection is neutered by using prepared statements. You might one day forget to manually escape a single input (and it only takes one to be game over), but if user data is always passed separately from the query string (i.e. you never concatenate), there's no opportunity to make this mistake. There were also corner-case escaping bypass attacks (usually involving Unicode) that you might not be vulnerable to. With prepared statements, these clever multibyte character tricks accomplish nothing. The query string is already in the database server before your user's parameters are sent.
I believe teaching developers to think in terms of taxonomy (very general to very specific) will result in a greater understanding of software security and reduce the incidence of vulnerable code.
I've written about this before, in case anyone wants to link to something besides an HN comment: https://paragonie.com/blog/2015/08/gentle-introduction-appli...
---
EDIT: Opened an issue: https://github.com/FallibleInc/security-guide-for-developers...
comment 10y ago · link · parent
comment 10y ago · link · parent
Agreed that public key crypto isn't really appropriate here.
1454.
Threat Modeling for Applications(adamcaudill.com ↗)
3 points · by CiPHPerCoder · 10y ago · discuss
comment 10y ago · link · parent
"The Cloud" isn't a company that has direct access to a certificate authority.
"The Cloud" doesn't produce a valid TLS certificate for YOUR website, to encrypt the connection between them and your visitors, but not necessarily between them and your server.
"The Cloud" is a vague term for "other people's computers".
CloudFlare is better than plaintext HTTP, but if your goal is confidentiality, then CloudFlare is probably worse than direct HTTPS with no intermediaries.
Again, threat models differ. For most people, CloudFlare is probably just fine.
1457.
Setting Up Caddy for PHP 7 on Debian Jessie (Automatic HTTPS)(paragonie.com ↗)
2 points · by CiPHPerCoder · 10y ago · discuss
comment 10y ago · link · parent
https://paragonie.com/blog/2016/04/go-php-7-our-commitment-m...
The short of it:
* PHP 7 allowed us a combination of type safety and brevity that makes it much easier to reason about the security of Halite in a way that PHP 5 does not.
* There is a very bad habit in the PHP community, led by WordPress, to provide very legacy support (i.e. PHP 5.2.4 in 2016). For that reason, we're going against the grain focusing on PHP 7 only. If people want to use any of our new open source libraries, they need to make the decision to upgrade now.
comment 10y ago · link · parent
Generally you want to just do this once:
$key = KeyFactory::generateEncryptionKey();
KeyFactory::save($key, '/path/outside/webroot');
And from then on: $key = KeyFactory::loadEncryptionKey('/path/outside/webroot');
Encryption typically never touches a password (although you can derive one from a password and salt if you so choose). The normal way of doing things is to just use a random key.(My takeaway is: the README for v3 probably needs work to make this more clear.)
Thanks for the feedback! :)
comment 10y ago · link · parent
I've been working on this project for a year now, and looking to push for a version 3 release before 2016 is over.
Halite takes a lot of guesswork out of cryptography. You don't even need to know what a nonce is to use it successfully.
I'd like to get more feedback from other developers if possible.
1461.
Show HN: Halite – A simple libsodium wrapper for PHP projects(github.com ↗)
43 points · by CiPHPerCoder · 10y ago · 10 comments
comment 10y ago · link · parent
Or moxie's, for that matter. He's been contacted by the Saudi government before and publicly turned down their offers to be complicit in their human rights violations. (He also wrote the encryption that WhatsApp uses.)
https://moxie.org/blog/saudi-surveillance/
More importantly, can anyone independently verify this? :)
comment 10y ago · link · parent
I'm not sure I agree with that.
Generating a code:
<?php
use ParagonIE\MuiltiFactor\Vendor\GoogleAuth;
use ParagonIE\MultiFactor\OTP\TOTP;
$seed = random_bytes(20);
/** Then persist $seed into the database for a user **/
$gauth = new GoogleAuth($seed, new TOTP());
header("Content-Type: image/png");
$gauth->makeQRCode();
Validating a code: <?php
use ParagonIE\MuiltiFactor\Vendor\GoogleAuth;
use ParagonIE\MultiFactor\OTP\TOTP;
if (\password_verify($_POST['password'], $storedHash)) {
$seed = /** Get seed from database for this user **/;
$gauth = new GoogleAuth($seed, new TOTP());
if ($gauth->validateCode($_POST['2facode'])) {
// Login successful
}
}
Then you can just use the 2FA app of your choice (Authy, Google Authenticator, etc.), scan the QR code, and you're good to go.comment 10y ago · link · parent
Kill it before it lays eggs.
> Requiring your password to be entered with mouse clicks at an on-screen keyboard. Not kidding.
[x] Bad security
[x] Bad usability
(Edit: apparently unicode checkmarks are filtered out on input now)
This is like the personification of a lose-lose interpretation of AviD's rule of usable security.comment 10y ago · link · parent
I started working on a vendor-agnostic 2FA implementation for PHP projects.
https://github.com/paragonie/multi_factor
It's far from complete, but hopefully it makes it easier for others to add 2FA to their projects.
If anyone's interested in the open source CMS I mentioned: https://github.com/paragonie/airship
1470.
Securing a PHP Application in 2016: The Pocket Guide(paragonie.com ↗)
2 points · by CiPHPerCoder · 10y ago · discuss