Commit Graph
9847 Commits
Author SHA1 Message Date
Jacques Le Roux a48938982d Improved: Migrate Ofbiz bb 0.8 config to 3.2 (OFBIZ-12456)
Comment out the XMLRPC tests. This alone should allow Buildbot 3.2 to run the
integration tests.

Conflict handled by hand
2021-12-16 07:11:01 +01:00
Jacques Le Roux 1feb709998 Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
Need to check for null before return
2021-11-19 10:06:35 +01:00
Jacques Le Roux 0ba7036f14 Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
Manually handled issues after cherry pick
2021-11-19 10:04:02 +01:00
Jacques Le Roux 8f6a1d361e Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
In ternary operator post increment does not work, pre increment does

Thanks: Spotbugs
2021-11-19 09:34:34 +01:00
Jacques Le Roux 5866e2dbdf Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
Char arrays can't use toString()

Thanks: Spotbugs :)

Conflicts handled by hand
EntitySaxReader.java
ControlServlet.java (no changes to do)
VisitHandler.java
2021-11-19 09:13:04 +01:00
Jacques Le Roux f5ded534e7 Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
Fixes a Spotbugs worry and clarifies code

Conflicts handled by merging cherry pick as HEAD, so several no functional changes
2021-11-18 14:24:37 +01:00
Jacques Le Roux 7828ba64f2 Improved: Fix OFBiz specific Javascript security issues reported by GH CodeQL (OFBIZ-12366)
No functional change (imports order) to test CodeQL setting
2021-11-14 20:24:58 +01:00
Wiebke Pätzold d6af7a1907 Fixed: Error while executing generateBlogRssFeed (OFBIZ-12363)
removes ServiceEventHandler.checkSecureParameter related to OFBIZ-11260

Thanks: Jacques Le Roux for report
2021-11-12 15:59:00 +01:00
Wiebke Pätzold a8f50c5759 Fixed: Builds fail due to unauthorized access to
repo.spring.io/plugins-release (OFBIZ-12351)

Replaces repository syndication by rometools

Thanks Mart Naum for report
2021-11-04 14:55:49 +01:00
Jacques Le Roux 7a78d4c837 Improved: Update build.gradle to the latest dependencies
(OFBIZ-11603)

Replaces deprecated calls

Conflicts handled by hand CrossSubdomainSessionValve.java
2021-10-26 08:02:00 +02:00
Jacques Le Roux 5ddb2b267f Fixed: DiskFileItem as request attribute creates problems (OFBIZ-12016)
With previous commit I removed UtilObject::getBytes but not
UtilObjectTests::testGetBytes_Stream which is related (see OFBIZ-11140)
2021-10-19 10:39:11 +02:00
Jacques Le Roux b21dff75d8 Fixed: DiskFileItem as request attribute creates problems (OFBIZ-12016)
This was related to reques-redirect usage with a file upload in the request.
More info at the Jira...

Thanks: Sebastian Berg and Benjamin Jugl for report
2021-10-19 07:07:01 +02:00
Jacques Le Roux 5a1006e2d3 Improved: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Prevents an useless inevitable warning by commenting out
RequestWrapper::getParameterNames and with it all the unused methods in
RequestWrapper class

Also better comments CacheFilter::doFilter by giving its real and only goal:
<<to prevent a post-auth security issue described in OFBIZ-12332>>
2021-10-11 09:44:14 +02:00
Jacques Le Roux c5aeab0fe9 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
When I removed service-permission-tests, I forgot to remove associated
load-data-service-permission-tests :/
2021-10-10 17:27:48 +02:00
Jacques Le Roux 92c4c5dbfe Improved: Refactor methods signature to reduce the number of params they use (OFBIZ-12335)
Fixes a typo about filterConfiguration in CacheFilter.java
2021-10-10 13:35:53 +02:00
Jacques Le Roux abb3fe31c2 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Removes service-permission-tests accidentally added while handling conflicts by
hand
2021-10-10 13:24:23 +02:00
Jacques Le Roux 6872e2a695 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
In previous commit, in CacheFilter::doFilter, I checked "xmlrpc"  when it was
actually "/control/xmlrpc"
2021-10-10 12:18:27 +02:00
Jacques Le Roux a1a24bd910 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
This definitely solves all issues by introducing a CacheFilter and
RequestWrapper classes inspired by several works found on the Net.
Also moves the change introduced before in ContextFilter to CacheFilter.

The basic problem is that you only can use once
ServletRequest::getInputStream or the ServletRequest::getReader
Also not both, even once, ie they can be seen as same from this POV.

The integration tests all pass.

Also replace the checked String "</serializable>" by "</serializable" as, like
reported by Jie Zhu, the former could be bypassed by using "</serializable >"

Thanks: Jie Zhu for report

# Conflicts handled by hand
  CacheFilter.java
  RequestWrapper.java
2021-10-10 08:13:43 +02:00
Jacques Le Roux 25293e4cf6 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
This definitely solves all issues by introducing a CacheFilter and
RequestWrapper classes inspired by several works found on the Net.
Also moves the change introduced before in ContextFilter to CacheFilter.

The basic problem is that you only can use once
ServletRequest::getInputStream or the ServletRequest::getReader
Also not both, even once, ie they can be seen as same from this POV.

The integration tests all pass.

Also replace the checked String "</serializable>" by "</serializable" as, like
reported by Jie Zhu, the former could be bypassed by using "</serializable >"

Thanks: Jie Zhu for report

Conflicts: ContextFilter.java handled by hand
2021-10-09 20:00:16 +02:00
Jacques Le Roux 02a544a820 Improved: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Temporarily comments out XMLRPC tests.

I'll work on a definitive solution ASAP

Conflicts handled by hand: framework/service/testdef/servicetests.xml
2021-10-09 08:00:18 +02:00
Jacques Le Roux 0603293fa9 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Fixes the "eternal" (for R17 and R18 ;) bug about MODULE (trunk) vs module
2021-10-08 19:31:28 +02:00
Jacques Le Roux d6d863020c Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
As reported by Jie Zhu:
<<The latest version of the OFBiz framework (17.12.08) is affected by an
XMLRPC Remote Code Execution Vulnerability.
This vulnerability is caused by incomplete patch repair of cve-2020-9496.>>

Actually this is not an OFBiz bug (so not related to CVE-2020-9496)
but an old XMLRPC bug (Archiva was(/is?)) also affected:
https://nvd.nist.gov/vuln/detail/CVE-2016-5003

Unfortunately XMLRPC is no longer maintained, so it's OFBiz responsibility to
fix this bug.

As the code that secures serialisation in OFBiz is not reached by this bug, the
solution is to secure it at the ContextFilter class level (ie before it reaches
secured serialisation in OFBiz source).

Thanks: Jie Zhu for report and help.
2021-10-08 19:14:57 +02:00
Gil Portenseigne 523c25d0ba Improved: Create a deny list to reject webshell tokens (OFBIZ-12324)
Improve readability using stream api.
Fix deniedWebShellTokens property where some blank space where removed
and '// python' comment was inlined.
2021-09-23 10:49:30 +02:00
Jacques Le Roux 8b852ff612 Improved: Create a deny list to reject webshell tokens (OFBIZ-12324)
Extracts the list of words used in SecuredUpload::isValidText in a
deniedWebShellTokens property in security.properties
2021-09-20 18:14:50 +02:00
Jacques Le Roux 4da54af4e0 Fixed: Groovy Program sandbox bypass (OFBIZ-12305)
This much increases the current security by creating SecuredUpload::isValidText
and call it from ProgramExport.groovy

This said I agree with thiscodecc that a better solution would be to use a
Groovy sandbox, and not only in ProgramExport.groovy.

I had a quick glance at a such solution. Unfortunately as Cédric Champeau reports
at https://melix.github.io/blog/2015/03/sandboxing.html and unlike thiscodecc
suggest there are no "mature solutions on the market".

Nevertheless I'll have a deeper look at an OFBiz specific Groovy sandbox
solution.

Somehow related: I'll also soon extract the list of words used in
SecuredUpload::isValidText in a deniedWebShellWords property in security.properties

Thanks: thiscodecc for report

Conflicts handled by hand
  framework/webtools/groovyScripts/entity/ProgramExport.groovy
2021-09-17 18:52:01 +02:00
Nicolas Malin 16526428f2 Fixed: Groovy DSL failed to use 'run service' from an event call (OFBIZ-12322)
When you call a groovy script from an event controller, some information are present note on the same place on the binding context.

Example if you call a groovy script as service you found the userLogin with parameters.userLogin or when you call it as event, the userLogin is on the binding context root.

The problem appear with the DSL method 'run service' who search the missing value need by a service (userLogin, locale and timezone) on the map parameters on the binding context, so failed to populate correctly the information for an event.

Call from event
    Map serviceResult = run service: 'createInvoice', with: [partyId: partyId, invoiceDate: nowTimestamp]

Failed due to security issue : missing userLogin on the service context.
2021-09-17 15:05:19 +02:00
Jacques Le Roux 0216f21f82 Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307)
Fixes a number of issues I spotted while working on OFBIZ-12305 in relation with
OFBIZ-12055

The last change I made for OFBIZ-12305 was incomplete, the files could not be
checked by SecuredUpload because they did not exist! This concerns
ImageManagementServices, DataServices, FrameImage and ProductServices classes.
I used Files::createTempFile to fix that.

Also fixes a bug in SecuredUpload where I reversed the check on
fileToCheck.length in Windows case. I also added a comment, Windows 10 now
allows more length (need an OS parameter change though)

Finally, creates public SecuredUpload::isValidText to be used in OFBIZ-12305

Conflicts handled by hand
  DataServices.java
2021-09-17 11:41:37 +02:00
Jacques Le Roux 7f3e1f58c4 Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)
Fixes a typo issue
2021-09-13 09:56:03 +02:00
Jacques Le Roux d4297a1c29 Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)
The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
2021-09-13 08:42:43 +02:00
Jacques Le Roux 9b5c721c2a Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)
The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
2021-09-13 08:16:01 +02:00
Jacques Le Roux 24c72edc4c Fixed: Found a new XXE (XML External Entity Injection) vulnerability in ArtifactInfo (OFBIZ-12306)
The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
2021-09-13 08:16:00 +02:00
Jacques Le Roux 4088e0a28e Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307)
Safer completing solution as recommended by weinull orz <weinull@outlook.com>
Previous commit was OK, but better be safe than sorry ;)

Also forgot to commit the DENIEDFILEEXTENSIONS checkstyle change last time

Thanks: weinull orz for the the right suggestion (done 2021-08-13)
2021-09-03 16:50:53 +02:00
Jacques Le Roux d0b4f2d164 Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307)
The fix I did is two folds:
filters extensions (thanks to Zhujie's suggestion of a list of extensions to ban)
deletes bad files at the right place (thanks to thiscodecc's report)

Thanks: thiscodecc for the security report
2021-09-03 13:48:05 +02:00
Jacques Le Roux 6e2c13a4eb Fixed: SecuredUpload::isValidTextFile wrong check with uppercase (OFBIZ-12301)
In SecuredUpload::isValidTextFile a wrong check is done

Thanks: Zhujie from Ping'an Technology
2021-08-10 13:03:39 +02:00
Nicolas Malin 5944749ee0 Fixed: IndexOutOfBoundsException on Entity Import (OFBIZ-12273)
Backport e4919d16ca from trunk

Removes the localhost (and 127.0.0.1) OOTB.
Allows to use it through a "multi-property" (list) in security.properties.
2021-07-28 14:32:36 +02:00
Nicolas Malin 7a55ea8906 Fixed: UserLoginHistory failed the store operation with large password (OFBIZ-12287)
Backport 2aa68dc4de from trunk

When you have a user with long password (greater than 256 characters) present in OFBiz and you try to log with, OFBiz return a long error message with sensitive information due to exceeding value size to store on the field UserLoginHistory.passwordUsed.

To solve this we don't return any information on the genericValue that failed and analyze the field passwordUsed to escape the case where the password set to login is create than the database field capacity.

Thanks to Daniel Elkabes <daniel.elkabes@whitesourcesoftware.com> and Hagai Wechsler <hagai.wechsler@whitesourcesoftware.com> from white source software to raise the problem.
2021-07-28 14:31:59 +02:00
Jacques Le Roux ace168d329 Fixed: Static initialization vectors for encryption (OFBIZ-12281)
(after discussing this on security@ofbiz.apache.org, it was decided to open a
Jira issue for that)

I've noticed that OFBiz Framework sometimes uses static initialization vectors
(IV) while creating a cipher:

https://s.apache.org/vhlbj
https://s.apache.org/nyndk

IVs should be unique and ideally unpredictable to avoid producing the same
ciphertexts for the same plaintexts.

The issues can be fixed with something like the following:

byte[] rawIV = new byte[8];
SecureRandom random = new SecureRandom();
random.nextBytes(rawIV).
IvParameterSpec iv = new IvParameterSpec(rawIV);

jleroux: this prepends the IV in order to decrypt the plaintexts. It's similar
to what has been done for the DesCrypt class. But contrary to the DesCrypt class
I did not test.

Thanks: Artem Smotrakov

Conflicts handled by hand (a lot)
ValueLinkApi.java
2021-07-23 09:29:07 +02:00
Jacques Le Roux bbc2d23f3a Fixed: Static initialization vectors for encryption (OFBIZ-12281)
(after discussing this on security@ofbiz.apache.org, it was decided to open a
Jira issue for that)

I've noticed that OFBiz Framework sometimes uses static initialization vectors
(IV) while creating a cipher:

https://s.apache.org/vhlbj
https://s.apache.org/nyndk

IVs should be unique and ideally unpredictable to avoid producing the same
ciphertexts for the same plaintexts.

The issues can be fixed with something like the following:

byte[] rawIV = new byte[8];
SecureRandom random = new SecureRandom();
random.nextBytes(rawIV).
IvParameterSpec iv = new IvParameterSpec(rawIV);

jleroux: we prepend the IV in order to decrypt the plaintexts. I'll do
something similar in ValueLinkApi class ASAP

Thanks: Artem Smotrakov

Conflicts handled by hand:
framework/base/src/main/java/org/apache/ofbiz/base/crypto/DesCrypt.java
2021-07-21 11:11:02 +02:00
Jacques Le Roux 8ec079fbfc Fixed: Add http to https redirect rule for ofbiz.apache.org (OFBIZ-10590)
This prevented to run the stable demo, hence the next
2021-07-20 07:38:34 +02:00
Nicolas Malin 076c1e254c Fixed: Link request-confirmation not generated on menus (OFBIZ-12278)
Menus link with request-confirmation and confirmation message do not generate the script that open confirmation

When you activate the following menu item :
      <menu-item name="statusToCancelled" title="${uiLabelMap.AccountingPaymentTabStatusToCancelled}">
          <link target="setPaymentStatus" request-confirmation="true" confirmation-message="You want to cancel this payment number ${payment.paymentId}?">
              ....
         </link>
      </menu-item>

OFBiz to not generate the js code link to the request-confirmation attribute because this functionality has been never implemented on java code for MenuRenderer

Thanks to Leila Mekika for raised this issue and solved it
2021-07-09 21:12:31 +02:00
Wiebke Pätzold 1f0797d5f3 Fixed: Adding tel protocol in CustomPermissivePolicy is not working
(OFBIZ-12258)

With these changes, the default sanitizers rules are only loaded if
there is no CustomPermissivePolicy
2021-06-22 12:03:27 +02:00
Jacques Le Roux bb254caddd Fixed: Unexpected decoding of url encoded textarea data after submission (OFBIZ-12249)
When trying to add a note to WorkEffort entity, I found that URL encoded
characters are unescaped, which is not expected.

e.g.:
1. Go to page: https://demo-trunk.ofbiz.apache.org/workeffort/control/EditWorkEffortNotes?workEffortId=TASK01
2. Add a note with content: https://example.com/a%20link
3. After submission, it will turned to be: https://example.com/a link

Thanks: Xin Wang for report and exchanges until solution I provided

Conflicts:
  UtilHttp.java: removes unused OOTB checkURLforSpiders for simplification
  UtilValidate.java: replaces DEFAULT_EMPTY_OK simply by true
2021-06-09 12:27:13 +02:00
Jacques Le Roux 7778b7692d Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
This is related to this question from Daniel at
https://github.com/apache/ofbiz-framework/pull/220

I couldn't figure out how to configure OFBiz with my Google API key so ended up
temporarily patching
themes/common-theme/template/includes/GeoLocation.ftl line 44 with my key.
Line 44 looked similar to:
<script src="https://maps.googleapis.com/maps/api/js?key=secret_google_api_key" type="application/javascript"></script>

Is there a way to configure ofbiz with the API key?

Disclaimer: w/o a not free "Google API key" I was not able to test, will ask
Daniel...

Conflicts handled by hand
  framework/common/config/general.properties
2021-05-30 06:33:23 +02:00
Jacques Le Roux b8f9c029ce Fixed: Plugin not showing in menu due to permission (OFBIZ-12233)
When creating a plugin via gradle :
./gradlew createPlugin -PpluginId=plugin-test -PpluginResourceName=PluginTest
-PwebappName=plugin-test -PbasePermission=PLUGIN_TEST

and loading all the required data and permissions, the plugin doesn't appear
in the menu.

It comes from the ComponentConfig.java file, L1229, when the permissions gets
trimmed and modified. I tried removing it locally and it fixed the problem.

Thanks: Gaetan Chaboussie
2021-05-17 12:00:37 +02:00
Aditya Sharma 38b97e6ad3 Fixed: removed unused asmselect files and unused variable asm_asmListItemPercentOfForm (OFBIZ-10113)
asm select library is already replaced with select2 library, but the library files still exist in code base unused.
asm_asmListItemPercentOfForm varaible was used to set the width of the selected items which were displaced distictly from select fields. With select2, the selected items display inside the input field so it is no more needed

Thanks Jacques Le Roux for reporting it
2021-05-12 12:20:23 +05:30
Jacques Le Roux 9730842eac Fixed: Secure the uploads (OFBIZ-12080)
Reopened after report of a bug (only on *nix systems) by Shrilesh Korgaonkar.
This fixes the issue

Thanks: Shrilesh Korgaonkar
2021-04-16 09:24:27 +02:00
Jacques Le Roux 2c6f3068de Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
In SafeObjectInputStream.properties
  Renames listOfSafeObjectsForInputStream to allowList and fixes it
  Introduces a denyList

Adapts SafeObjectInputStream class to new denyList

Conflicts handled by hand
  framework/base/config/SafeObjectInputStream.properties
  framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
2021-04-07 09:18:24 +02:00
Jacques Le Roux 544d207cbd Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
Prevents generics markup in string type names.

Conflict handled by hand
  framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
2021-04-05 17:04:59 +02:00
Jacques Le Roux e5809580bb Documented: Comment out the SOAP and HTTP engines (OFBIZ-12212)
Documents that the EntitySync feature is no longer available OOTB.
You need first to re allow the HTTP engine
2021-03-30 13:05:25 +02:00
Jacques Le Roux 0f82c2679f Improved: Improve UtilObject class (OFBIZ-12216)
This removes the inoffensive but annoying message in log (which does not show in
trunk, see https://github.com/apache/ofbiz-framework/commit/27c9180/

Not the same as in trunk, simply handling with exception Rather than returning
null, also shorten java.rmi.server to java.rmi to block more cases
2021-03-30 12:38:19 +02:00