{"id":17389561,"date":"2024-02-01T07:17:15","date_gmt":"2024-02-01T07:17:15","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/security-issue-159\/"},"modified":"2024-02-01T07:40:03","modified_gmt":"2024-02-01T07:40:03","slug":"security-issue-159","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/security-issue-159\/","title":{"rendered":"Security issue"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When user&#8217;s logged in and tries to view a license that doesn&#8217;t exist, an error is generated that is not handled by the plugin. For example is there&#8217;s no license with ID 123 and the user calls:<br \/><br \/>https:\/\/example.com\/my-account\/view-license-keys\/123\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The plugin doesn&#8217;t handle the error properly and depending on the theme error handling logic, sensitive information about server directory structure, database, and tokens can be revealed.<br \/><br \/>The issue is cause by \/wp-content\/plugins\/license-manager-for-woocommerce\/includes\/Integrations\/WooCommerce\/MyAccount.php at line 238 in viewLicenseKeys() and can be solved by a simple if statement like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if($license != null) {\n\n\t$decrypted = $license-&gt;getDecryptedLicenseKey();\n\n    if ( is_wp_error( $decrypted ) ) {\n        echo sprintf( '&lt;p&gt;%s&lt;\/p&gt;', $decrypted-&gt;get_error_message() );\n\n    \treturn;\n\t}\n\techo wc_get_template_html(\n        'myaccount\/single.php',\n        array(\n        \t'license'     =&gt; $license,\n    \t    'license_key' =&gt; $license-&gt;getDecryptedLicenseKey(),\n\t        'product'     =&gt; ! empty( $license-&gt;getProductId() ) ? wc_get_product( $license-&gt;getProductId() ) : null,\n            'order'       =&gt; ! empty( $license-&gt;getOrderId() ) ? wc_get_order( $license-&gt;getOrderId() ) : null,\n            'date_format' =&gt; get_option( 'date_format' ),\n        ),\n        '',\n        LMFWC_TEMPLATES_DIR\n\t);\n}\nelse {\n\techo 'Invalid license key';\n}\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Please proceed as it can be misused and put websites in danger easily.<\/p>\n","protected":false},"template":"","class_list":["post-17389561","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17389561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17389561\/revisions"}],"predecessor-version":[{"id":17389603,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17389561\/revisions\/17389603"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17389561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}