Ошибки бизнес логики

All about bug bounty (bypasses, payloads, and etc) - AllAboutBugBounty/Business Logic Errors.md at master · daffainfo/AllAboutBugBounty

Business Logic Errors

Introduction

Business Logic Errors are ways of using the legitimate processing flow of an application in a way that results in a negative consequence to the organization.

Where to find

This vulnerability can appear in all features of the application.

How to exploit

  1. Review Functionality

    • Some applications have an option where verified reviews are marked with some tick or it’s mentioned. Try to see if you can post a review as a Verified Reviewer without purchasing that product.
    • Some app provides you with an option to provide a rating on a scale of 1 to 5, try to go beyond/below the scale-like provide 0 or 6 or -ve.
    • Try to see if the same user can post multiple ratings for a product. This is an interesting endpoint to check for Race Conditions.
    • Try to see if the file upload field is allowing any exts, it’s often observed that the devs miss out on implementing protections on such endpoints.
    • Try to post reviews like some other users.
    • Try performing CSRF on this functionality, often is not protected by tokens
  2. Coupon Code Functionality

    • Apply the same code more than once to see if the coupon code is reusable.
    • If the coupon code is uniquely usable, try testing for Race Condition on this function by using the same code for two accounts at a parallel time.
    • Try Mass Assignment or HTTP Parameter Pollution to see if you can add multiple coupon codes while the application only accepts one code from the Client Side.
    • Try performing attacks that are caused by missing input sanitization such as XSS, SQLi, etc. on this field
    • Try adding discount codes on the products which are not covered under discounted items by tampering with the request on the server-side.
  3. Delivery Charges Abuse

    • Try tampering with the delivery charge rates to -ve values to see if the final amount can be reduced.
    • Try checking for the free delivery by tampering with the params.
  4. Currency Arbitrage

    • Pay in 1 currency say USD and try to get a refund in EUR. Due to the diff in conversion rates, it might be possible to gain more amount.
  5. Premium Feature Abuse

    • Try forcefully browsing the areas or some particular endpoints which come under premium accounts.
    • Pay for a premium feature and cancel your subscription. If you get a refund but the feature is still usable, it’s a monetary impact issue.
    • Some applications use true-false request/response values to validate if a user is having access to premium features or not.
    • Try using Burp’s Match & Replace to see if you can replace these values whenever you browse the app & access the premium features.
    • Always check cookies or local storage to see if any variable is checking if the user should have access to premium features or not.
  6. Refund Feature Abuse

    • Purchase a product (usually some subscription) and ask for a refund to see if the feature is still accessible.
    • Try for currency arbitrage explained yesterday.
    • Try making multiple requests for subscription cancellation (race conditions) to see if you can get multiple refunds.
  7. Cart/Wishlist Abuse

    • Add a product in negative quantity with other products in positive quantity to balance the amount.
    • Add a product in more than the available quantity.
    • Try to see when you add a product to your wishlist and move it to a cart if it is possible to move it to some other user’s cart or delete it from there.
  8. Thread Comment Functionality

    • Unlimited Comments on a thread
    • Suppose a user can comment only once, try race conditions here to see if multiple comments are possible.
    • Suppose there is an option: comment by the verified user (or some privileged user) try to tamper with various parameters in order to see if you can do this activity.
    • Try posting comments impersonating some other users.
  9. Parameter Tampering

    • Tamper Payment or Critical Fields to manipulate their values
    • Add multiple fields or unexpected fields by abusing HTTP Parameter Pollution & Mass Assignment
    • Response Manipulation to bypass certain restrictions such as 2FA Bypass

References

  • @harshbothra_

Business Logic Errors

Introduction

Business Logic Errors are ways of using the legitimate processing flow of an application in a way that results in a negative consequence to the organization.

Where to find

This vulnerability can appear in all features of the application.

How to exploit

  1. Review Functionality

    • Some applications have an option where verified reviews are marked with some tick or it’s mentioned. Try to see if you can post a review as a Verified Reviewer without purchasing that product.
    • Some app provides you with an option to provide a rating on a scale of 1 to 5, try to go beyond/below the scale-like provide 0 or 6 or -ve.
    • Try to see if the same user can post multiple ratings for a product. This is an interesting endpoint to check for Race Conditions.
    • Try to see if the file upload field is allowing any exts, it’s often observed that the devs miss out on implementing protections on such endpoints.
    • Try to post reviews like some other users.
    • Try performing CSRF on this functionality, often is not protected by tokens
  2. Coupon Code Functionality

    • Apply the same code more than once to see if the coupon code is reusable.
    • If the coupon code is uniquely usable, try testing for Race Condition on this function by using the same code for two accounts at a parallel time.
    • Try Mass Assignment or HTTP Parameter Pollution to see if you can add multiple coupon codes while the application only accepts one code from the Client Side.
    • Try performing attacks that are caused by missing input sanitization such as XSS, SQLi, etc. on this field
    • Try adding discount codes on the products which are not covered under discounted items by tampering with the request on the server-side.
  3. Delivery Charges Abuse

    • Try tampering with the delivery charge rates to -ve values to see if the final amount can be reduced.
    • Try checking for the free delivery by tampering with the params.
  4. Currency Arbitrage

    • Pay in 1 currency say USD and try to get a refund in EUR. Due to the diff in conversion rates, it might be possible to gain more amount.
  5. Premium Feature Abuse

    • Try forcefully browsing the areas or some particular endpoints which come under premium accounts.
    • Pay for a premium feature and cancel your subscription. If you get a refund but the feature is still usable, it’s a monetary impact issue.
    • Some applications use true-false request/response values to validate if a user is having access to premium features or not.
    • Try using Burp’s Match & Replace to see if you can replace these values whenever you browse the app & access the premium features.
    • Always check cookies or local storage to see if any variable is checking if the user should have access to premium features or not.
  6. Refund Feature Abuse

    • Purchase a product (usually some subscription) and ask for a refund to see if the feature is still accessible.
    • Try for currency arbitrage explained yesterday.
    • Try making multiple requests for subscription cancellation (race conditions) to see if you can get multiple refunds.
  7. Cart/Wishlist Abuse

    • Add a product in negative quantity with other products in positive quantity to balance the amount.
    • Add a product in more than the available quantity.
    • Try to see when you add a product to your wishlist and move it to a cart if it is possible to move it to some other user’s cart or delete it from there.
  8. Thread Comment Functionality

    • Unlimited Comments on a thread
    • Suppose a user can comment only once, try race conditions here to see if multiple comments are possible.
    • Suppose there is an option: comment by the verified user (or some privileged user) try to tamper with various parameters in order to see if you can do this activity.
    • Try posting comments impersonating some other users.
  9. Parameter Tampering

    • Tamper Payment or Critical Fields to manipulate their values
    • Add multiple fields or unexpected fields by abusing HTTP Parameter Pollution & Mass Assignment
    • Response Manipulation to bypass certain restrictions such as 2FA Bypass

References

  • @harshbothra_

Начинающие тестировщики могут путать эти параметры, но у них есть существенные отличия. Давайте разберемся в этом подробней.

Для начала рассмотрим каждый атрибут в отдельности.

Серьезность

Серьезность (Severity) — это атрибут, характеризующий влияние дефекта на работоспособность приложения. Проставляется специалистом по тестированию.

Серьезность имеет несколько параметров в зависимости от типа дефекта. Ее степень зависит от того, как она влияет на бизнес-логику (реализацию правил программы).

  • S1 – Блокирующая (Blocker). Блокирующая ошибка, приводящая приложение в нерабочее состояние, в результате которого дальнейшая работа с тестируемой системой или ее функциями становится невозможна.
  • S2 – Критическая (Critical). Критическая ошибка, неправильно работающая бизнес-логика, проблема, приводящая в нерабочее состояние некоторую часть системы, но есть возможность для работы с тестируемой функцией, используя другие входные точки.
  • S3 – Значительная (Major). Значительная ошибка, часть бизнес-логики работает некорректно. Ошибка не критична или есть возможность для работы с тестируемой функцией, используя другие входные точки.
  • S4 – Незначительная (Minor). Незначительная ошибка, не нарушающая бизнес-логику тестируемой части приложения, очевидная проблема пользовательского интерфейса.
  • S5 – Тривиальная (Trivial). Тривиальная ошибка, не касающаяся бизнес-логики приложения, плохо воспроизводимая проблема, малозаметная по средствам пользовательского интерфейса, проблема сторонних библиотек или сервисов, проблема, не оказывающая никакого влияния на общее качество продукта.

Из описания видно, что с помощью Серьезности мы указываем как найденная ошибка влияет на тестируемое приложение. Если из-за ошибки приложение полностью не работает, то Серьезность высокая. Если найденный дефект мало влияет на функционал и больше относится к визуальной части (например, опечатка в слове), то Серьезность низкая.

Давайте рассмотрим несколько примеров проблем и попробуем правильно определить их Серьезность. Чтобы было понятно, представим, что мы тестируем приложение по заказу такси.

1.Приложение «падает» при попытке найти свободное такси.
Чтобы правильно поставить Серьезность, необходимо определить влияние ошибки на дальнейшую работу функционала. Из названия видно, что после появления ошибки приложение перестает работать. Значит, влияние высокое.

Сразу же отбрасываем Тривиальную и Незначительную Серьезность, так как из их описания понятно, что ошибка не должна сильно влиять на приложение.

У нас остается только три варианта: Значительная, Критическая и Блокирующая серьезности.

Подходит ли нам Значительная Серьезность? Очевидно, что нет. Во-первых, ошибка достаточно критична. Во-вторых, другим способом найти такси мы не можем, т.е. нет возможности работы с тестируемой функцией, используя другие входные точки. Более того, функционал работает не некорректно, а не работает вообще.

Остаются Критическая и Блокирующая серьезности. В нашем случае Блокирующая подходит больше, так как часть функционала не работает и нет других возможностей найти такси. Следовательно, мы выставляем Блокирующую Серьезность.

2. Невозможно указать адрес назначения с помощью “Указать на карте”.
Снова начинаем рассуждать. Тривиальная и Незначительная не подходят, потому что ошибка в какой-то мере нарушают бизнес логику работы приложения. Блокирующую можно не брать, т.к. функционал в целом работает и его можно использовать через другую точку входа, а именно ввести адрес вручную. Остается только два варианта: Критическая и Значительная. Мы уже сказали, что проблема не приводит к полной неработоспособности части функционала. Тем не менее это значительная ошибка, т.к. функционал частично не работает, следовательно остается только вариант Значительная. Его мы и укажем.

Как вы могли понять, Серьезность относится к технической части приложения и указывает на то, как сильно ошибка влияет на работоспособность приложения.

Приоритет

Приоритет отличается от Серьезности тем, что указывает когда необходимо исправить ошибку.

Приоритет (Priority) – это атрибут, указывающий на очередность выполнения задачи или устранения дефекта. Проставляется руководителем или менеджером проекта.

  • P1 – Высокий (High) – требуется исправить в первую очередь.
  • P2 – Средний (Medium) – требуется исправить во вторую очередь, когда нет дефектов с высоким приоритетом.
  • P3 – Низкий (Low) – исправляется в последнюю очередь, когда все дефекты с более высоким приоритетом уже исправлены.

С помощью приоритета менеджер проекта говорит, когда стоит исправить найденную проблему.

На первый взгляд можно подумать, что Приоритет и Серьезность одинаковы, ведь чем серьезней ошибка, тем быстрее её нужно исправить. Но, если глубже рассмотреть эти атрибуты, то можно найти различия.

Например, мы нашли опечатку в слове. Из названия видно, что это ошибка с Незначительной серьезностью и, вроде бы, ее не стоит исправлять в приоритете. Но если это слово находится на главном экране и является частью названия приложения, то, очевидно, что ее необходимо исправить как можно раньше.

Приоритет определяется исходя из масштабности проблем для пользователей и продукта. Для понимая можно использовать матрицу:

Матрица определения приоритета
Матрица определения приоритета

Теперь, когда мы разобрались что означает каждый атрибут, давайте посмотрим в чем их различие:

Различия Серьезности и Приоритета
Различия Серьезности и Приоритета

________________________________
Если остались вопросы по определению параметров Серьезность и Приоритет, то задавайте их в комментариях к статье.
________________________________

Предыдущие статьи по оформлению баг-репорта:
Назначение отчета https://sedtest-school.ru/testovaya-dokumentacziya/otchety-o-defektah-naznachenie/
Шаблон отчета об ошибке https://sedtest-school.ru/testovaya-dokumentacziya/otchety-o-defektah-shablon-otcheta-ob-oshibke/

Предположим, у нас есть некоторая иерархия объектов, построенная с помощью композиции. Есть ли шаблон для регистрации ошибок бизнес-логики во внутренних объектах и ​​передачи их вышестоящим объектам?

я просто устал от всего этого addErrors, получитьОшибки на каждом уровне и чувствую, что делаю что-то не так.

Я знаю об исключениях, но не знаю, как их использовать в таком случае. Ошибка бизнес-логики технически не является критической ситуацией, которая должна привести к прерыванию выполнения программы. На самом деле прерывание вообще не предполагается, потому что нам нужно зарегистрировать ошибку и просто двигаться дальше.

Заранее спасибо, если поделитесь мудростью и знаниями)

Небольшой фрагмент для иллюстрации проблемы:

class ErrorContainer {
    private $errors = array();
    function addError($error) { if (!is_array($error)) { $this->errors[] = $error;} else { $this->errors = array_merge($this->errors, $error); } }
    function getErrors() { return $this->errors[]; }
    function hasErrors() { return !empty($this->errors); }
}

class Processor extends ErrorContainer {
    function process($account_id, $orders) {
        $account = new Account();
        if (!$account->loadById($account_id)) { $this->addErrors($account->getErrors);}

        foreach ($orders as $order_id) {
            $order = new Order();
            if (!$order->loadById($order_id)) { $this->addErrors($order->getErrors);}
        }
    }

    return $this->hasErrors();
}

class Account extends ErrorContainer {
    function loadById($account_id) {
        $account = select_from_database($account_id);
        if (!$account) { $this->addError("Account is missing"); }
        if (!$account['active']) { $this->addError("Account is inactive"); }
        // and so on, some checks may add errors in a cycle

        return $this->hasErrors();
    }
}

class Order extends ErrorContainer {} // very similar to Account, but has its own checks

//Usage:

$errors = array();
$items = load_items_from_xml($xml);
foreach ($items as $item) {
    $processor = new Processor();
    if (!$processor->process($item['account_id'], $item['orders'])) {
        $errors = array_merge($errors, $processor->getErrors());
    }
}

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Ошибки бежецкого компрессора
  • Ошибки бедных людей
  • Ошибки баф феникс 1044
  • Ошибки баскетбола кратко
  • Ошибки барометрических высотомеров

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии