From 8120f75b21186978bc87fafdc9f0b80e2ee500dc Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 26 Jun 2020 09:28:49 +0200 Subject: [PATCH] Fixed: IDOR vulnerability in the order processing feature in ecommerce component (OFBIZ-11836) https://demo-stable.ofbiz.apache.org/ecommerce/control/order.pdf?orderId=WSCO10000 In the above URL, the parameter 'orderId' has the value 'WSCO10000' and after incrementing the value to 'WSCO10001' or 'WSCO10002' will download the receipt of other orders which have been placed by other users. All the available order receipts can be downloaded by running an automated tool (Burp Intruder) on the parameter 'orderId=WSCOXXXXX' I have successfully tested this by using 2 different accounts: DemoCustomer and DemoCustomer2 An attacker can download order receipts of other users and this could lead to information disclosure. The only real solution to this issue is to implement access control. The user needs to be authorized for the requested information before the server provides it. Thanks: Harshit Shukla [mailto:harshit.shukz@gmail.com]reported this IDOR vulnerability to the OFBiz security team, and we thank him for that. --- .../order/OrderViewWebSecure.groovy | 22 ++++ .../widget/ordermgr/OrderPrintScreens.xml | 103 ++++++++++-------- 2 files changed, 82 insertions(+), 43 deletions(-) diff --git a/applications/order/groovyScripts/order/OrderViewWebSecure.groovy b/applications/order/groovyScripts/order/OrderViewWebSecure.groovy index fd38170a66..c5bdd5b7ed 100644 --- a/applications/order/groovyScripts/order/OrderViewWebSecure.groovy +++ b/applications/order/groovyScripts/order/OrderViewWebSecure.groovy @@ -21,6 +21,9 @@ import org.apache.ofbiz.order.order.OrderContentWrapper orderHeader = context.orderHeader +// can anybody view an anonymous order? this is set in the screen widget and should only be turned on by an email confirmation screen +allowAnonymousView = context.allowAnonymousView + // if orderHeader is null in OrderView.groovy then it is not null but void here! if (orderHeader) { // set hasPermission, must always exist if the orderHeader != null @@ -44,9 +47,28 @@ if (orderHeader) { hasPermission = true } } + // This is related with OFBIZ-11836 "IDOR vulnerability in the order processing feature" + if (parameters.localDispatcherName.equals("ecommerce")) { + List errMsgList = [] + if (orderHeader.createdBy.equals(person.partyId) + || ("anonymous".equals(orderHeader.createdBy) && "Y".equals(allowAnonymousView))) { + hasPermission = true + canViewInternalDetails = true + } else { + hasPermission = false + canViewInternalDetails = false + errMsgList.add("It's not an error : you are not allowed to view this!") + showErrorMsg = "Y" + } + request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList) + context.showErrorMsg = showErrorMsg + } + context.hasPermission = hasPermission context.canViewInternalDetails = canViewInternalDetails orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request) context.orderContentWrapper = orderContentWrapper + + } diff --git a/applications/order/widget/ordermgr/OrderPrintScreens.xml b/applications/order/widget/ordermgr/OrderPrintScreens.xml index 367eeba7e6..079c8126dd 100644 --- a/applications/order/widget/ordermgr/OrderPrintScreens.xml +++ b/applications/order/widget/ordermgr/OrderPrintScreens.xml @@ -27,55 +27,72 @@ under the License.
- - - - + + + + -