Security Release for issue 15205

Clément Mercier using Claude has discovered that there is no restriction on running wizards without any model or group.

Impact

CVSS v3.0 Base Score: 8.1

  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: Low
  • User Interaction: None
  • Scope: Unchanged
  • Confidentiality: High
  • Integrity: High
  • Availability: None

Workaround

Add at least one group to the listed wizards in the issue via “Administration / User Interface / Actions / Wizards”.
This must also be done after the update in order to allow users to execute the said wizards.

Resolution

All affected users should upgrade trytond to the latest version and ensure that no unwanted users have been created on the system.

Affected versions per series:

  • trytond:
    • 8.2: <= 8.2.1
    • 8.0: <= 8.0.12
    • 7.8: <= 7.8.18
    • 7.0: <= 7.0.59

Not affected versions per series:

  • trytond:
    • 8.2: >= 8.2.2
    • 8.0: >= 8.0.13
    • 7.8: >= 7.8.19
    • 7.0: >= 7.0.60

Reference

Concerns?

Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.

Good morning, it appears that the commit Add model or groups to wizards to restrict execution (2e84ffa5c760) · Commits · Tryton / Tryton · GitLab has not been backported to versions 7.0 and 8.0.

Blocking the execution of wizards if the user is not an administrator.

They can not be backported because it is a database change.
That’s why this quote:

1 Like

Here is a small trytond-console script to assign groups to the standard wizards listed in the advisory. It preserves existing groups and model restrictions, and commits changes when run.

It also reports other wizards without groups, including custom ones, for manual review.


"""Run with trytond-console -d DATABASE -c CONFIG -f this_file.py."""

ADMIN = ('res.group_admin',)
ACCOUNT = ('account.group_account',)
ACCOUNT_ADMIN = ('account.group_account_admin',)
BUDGET = ('account_budget.group_budget',)
STOCK = ('stock.group_stock',)

# Suggested policy for the security advisory and related upstream actions.
# Review against your installation's permissions before applying.
GROUPS = {
    'res.user.config': ADMIN,
    'company.company.config': ('company.group_company_admin',),
    'ir.module.config': ADMIN,
    'ir.translation.set': ADMIN,
    'ir.translation.clean': ADMIN,
    'account.create_chart': ACCOUNT_ADMIN,
    'account.update_chart': ACCOUNT_ADMIN,
    'account.fiscalyear.create_periods': ACCOUNT_ADMIN,
    'account.fiscalyear.balance_non_deferral': ACCOUNT_ADMIN,
    'account.move.reconcile_lines': ACCOUNT,
    'account.move.unreconcile_lines': ACCOUNT,
    'account.reconcile': ACCOUNT,
    'account.move.cancel': ACCOUNT,
    'account.move.template.create': ACCOUNT,
    'account.move.line.group': ACCOUNT,
    'account.general_ledger.account.party.open': ACCOUNT,
    'account.asset.create_moves': ACCOUNT,
    'account.asset.print_depreciation_table': ACCOUNT,
    'account.budget.copy': BUDGET,
    'analytic_account.budget.copy': BUDGET,
    'account.budget.line.create_periods': BUDGET,
    'account.fr.fec': ACCOUNT,
    'account.statement.reconcile': (
        'account.group_account', 'account.group_account_admin',
        'account_statement.group_statement'),
    'account.stock.eu.intrastat.declaration.export': ACCOUNT,
    'stock.shipment.pack': STOCK,
    'stock.package.pack': STOCK,
}


def update_wizards(pool, transaction):
    Action = pool.get('ir.action.wizard')
    Data = pool.get('ir.model.data')
    identifiers = {}
    for record in Data.search([('model', '=', 'ir.action.wizard')]):
        identifiers.setdefault(record.db_id, []).append(
            '%s.%s' % (record.module, record.fs_id))

    changes = []
    for action in Action.search([]):
        if action.groups:
            continue  # Preserve existing permissions.
        name = action.wiz_name
        if name not in GROUPS:
            print('REVIEW id=%s wizard=%s xml=%s model=%s (no groups)' % (
                action.id, name, ','.join(identifiers.get(action.id, []))
                or '<no XML ID>', action.model or '<none>'), flush=True)
        elif not action.model:  # Preserve existing model-based restrictions.
            groups = [Data.get_id(*xml_id.split('.', 1))
                for xml_id in GROUPS[name]]
            changes.append((action, groups))
            print('ADD id=%s wizard=%s groups=%s (previously empty)' % (
                action.id, name, ','.join(GROUPS[name])), flush=True)

    # Resolve the complete plan before writing; commit everything together.
    for action, groups in changes:
        Action.write([action], {'groups': [('add', groups)]})
    for action, groups in changes:
        if {g.id for g in Action(action.id).groups} != set(groups):
            raise RuntimeError('Verification failed: %s' % action.wiz_name)
    transaction.commit()
    print('COMMITTED: %s action(s)' % len(changes), flush=True)


# These variables are supplied by trytond-console.
if 'pool' in globals() and 'transaction' in globals():
    update_wizards(pool, transaction)