Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2020-35773: wp_create_nonce() | Function | WordPress Developer Resources

The site-offline plugin before 1.4.4 for WordPress lacks certain wp_create_nonce and wp_verify_nonce calls, aka CSRF.

CVE
#csrf#git#wordpress#php

wp_create_nonce( string|int $action = -1 )

Creates a cryptographic token tied to a specific action, user, user session, and window of time.

Contents

  • Parameters
  • Return
  • More Information
  • Source
  • Related
    • Uses
    • Used By
  • Changelog
  • User Contributed Notes

Parameters

$action

(string|int) (Optional) Scalar value to add context to the nonce.

Default value: -1

Top ↑

Return

(string) The token.

Top ↑

More Information

The function should be called using the init or any subsequent action hook. Calling it outside of an action hook can lead to problems, see the ticket #14024 for details.

Top ↑

Source

File: wp-includes/pluggable.php

function wp\_create\_nonce( $action = -1 ) {
    $user = wp\_get\_current\_user();
    $uid  = (int) $user->ID;
    if ( ! $uid ) {
        /\*\* This filter is documented in wp-includes/pluggable.php \*/
        $uid = apply\_filters( 'nonce\_user\_logged\_out', $uid, $action );
    }

    $token = wp\_get\_session\_token();
    $i     = wp\_nonce\_tick();

    return substr( wp\_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
}

Expand full source code Collapse full source code View on Trac View on GitHub

Top ↑

Changelog

Changelog

Version

Description

4.0.0

Session tokens were integrated with nonce creation

2.0.3

Introduced.

Top ↑

User Contributed Notes

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907