You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Form nonce (CSRF token) is generated but never checked #400
Forms add a token with w2p_Output_HTML_FormHelper::addNonce(), and the docs page on security nonces says w2p_Controllers_Base validates it. It doesn't: the check in classes/w2p/Controllers/Base.class.php has an empty body, and its comment says it would be turned on in v4.0:
if (('' != $AppUI->__nonce) && ($AppUI->__nonce != $myArray['__nonce'])) {
}
So none of the forms that save or delete through w2p_Controllers_Base are protected against cross-site request forgery. Most other do_*_aed.php controllers don't check a token at all.
The token is also weak if it were checked: it is md5(time() . implode($user_prefs)), so it is predictable, and only the most recently generated one is kept, so a second open form invalidates the first.
Fix:
Generate the token with random_bytes(), keep it per session (or per form), and compare with hash_equals().
Reject the request in w2p_Controllers_Base::process() when the token is missing or wrong.
Add the same check to the controllers that don't use w2p_Controllers_Base, and make sure every form that changes data calls addNonce().
Change state-changing GET links (such as logout and ending sessions) to POST.
Mentioned in the Security Notes' known limitations for the logout links only; this is wider.
Activity
Check a form token on every request that changes data (CSRF)
CSRF: logout, ending sessions and module admin links need the form token
Logout button carries logout=-1 itself; demo seed uses tokened module…