CVE-2023-6832 (published 2023-12-15T01:15Z)

Business Logic Errors in GitHub repository microweber/microweber prior to 2.0.

CVSS v3 base score: 4.3, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N)

Weakness information:
cwe_id: CWE-840
cwe_name: Business Logic Errors
description: Weaknesses in this category identify some of the underlying problems that commonly allow attackers to manipulate the business logic of an application. Errors in business logic can be devastating to an entire application. They can be difficult to find automatically, since they typically involve legitimate use of the application's functionality. However, many business logic errors can exhibit patterns that are similar to well-understood implementation and design weaknesses.

Fix information:
repo_url: https://github.com/microweber/microweber
commit_details: repo_url: https://github.com/microweber/microweber
author: Peter Ivanov
author_date: 2023-06-09 12:23:44+03:00
msg: update
repository: repo_url: https://github.com/microweber/microweber
repo_name: microweber/microweber
description: Drag and Drop Website Builder and CMS with E-commerce
repo_language: HTML
owner: microweber
file_changes: filename: CheckoutManager.php
change_type: ModificationType.MODIFY
diff: @@ -408,10 +408,10 @@ class CheckoutManager
                     $posted_fields[$value] = $data[$value];
                 }
             }
-
+            $canUseCoupons = $this->app->option_manager->get('enable_coupons', 'shop') == 1;
 
             // Discount details save
-            if ($coupon_code) {
+            if ($canUseCoupons and $coupon_code) {
                 $place_order['promo_code'] = $coupon_code;
                 $place_order['coupon_id'] = $coupon_id;
                 $place_order['discount_type'] = $discount_type;

programming_language: PHP
filename: admin.php
change_type: ModificationType.MODIFY
diff: @@ -84,7 +84,7 @@ $coupon_get_count = coupon_get_count();
             if ($coupon_get_count > 0) {
                 ?>
                 <label class="form-check form-check-single form-switch ps-0 mb-4" style="width: unset;">
-                    <input type="checkbox" name="enable_coupons" class="mw_option_field form-check-input" id="enable_coupons" data-option-group="shop" data-value-checked="y" data-value-unchecked="n" <?php if (get_option('enable_coupons', 'shop') == 1): ?>checked<?php endif; ?> />
+                    <input type="checkbox" name="enable_coupons" class="mw_option_field form-check-input" id="enable_coupons" data-option-group="shop" data-value-checked="1" data-value-unchecked="0" <?php if (get_option('enable_coupons', 'shop') == 1): ?>checked<?php endif; ?> />
                     &nbsp; <?php _e('Enable'); ?>
                 </label>
             <?php

programming_language: PHP
filename: functions.php
change_type: ModificationType.MODIFY
diff: @@ -21,6 +21,11 @@ function coupon_apply($params = array())
     $coupon_code = $params['coupon_code'];
     $coupon_code = xss_clean($coupon_code);
 
+    if (get_option('enable_coupons', 'shop') == 0){
+        $json['error_message'] = _e('The coupon code usage is disabled.', true);
+        return $json;
+    }
+
     $coupon = coupon_get_by_code($coupon_code);
     if (empty($coupon)) {
         $json['error_message'] = _e('The coupon code is not valid.', true);

programming_language: PHP