Skip to content
Access control Audit finding Intermediate

The Restriction Manager does not completely implement ERC1404 which leads to accounts that are supposed to be restricted actually having access to do with their tokens as they see fit

The RestrictionManager contract only checks the recipient address in transfer restrictions, not the sender, so a blacklisted user can still transfer tokens to a valid member. This allows blacklisted accounts to move their tokens despite intended restrictions.

Bauchibred Follow with josephdara, ast3ros and 5 others

Originally disclosed on Code4rena

Submitted by Bauchibred, also found by josephdara, ast3ros, Ch_301, BARW, 0xnev, degensec, and J4X

Medium, contract’s intended logic is for blacklisted users not to be able to interact with their system so as to follow rules set by regulationary bodies in the case where a user does anything that warrants them to be blacklisted, but this is clearly broken since only half the window is closed as current implementation only checks on receiver being blacklisted and not sender.

Proof of Concept

The current implementation of the ERC1404 restrictions within the RestrictionManager.sol contract only places restrictions on the receiving address in token transfer instances. This oversight means that the sending addresses are not restricted, which poses a regulatory and compliance risk. Should a user be blacklisted for any reason, they can continue to transfer tokens as long as the receiving address is a valid member. This behaviour is contrary to expectations from regulatory bodies, especially say in the U.S where these bodies are very strict and a little in-compliance could land Centrifuge a lawsuit., which may expect complete trading restrictions for such blacklisted individuals.

Within the RestrictionManager contract, the method detectTransferRestriction only checks if the receiving address (to) is a valid member:

RestrictionManager.sol#L28-L34

function detectTransferRestriction(address from, address to, uint256 value) public view returns (uint8) {
    if (!hasMember(to)) {
        return DESTINATION_NOT_A_MEMBER_RESTRICTION_CODE;
    }
    return SUCCESS_CODE;
}

In the above code, the sending address (from) is never checked against the membership restrictions, which means blacklisted users can still initiate transfers and when checking the transfer restriction from both tranchtoken.sol and the liquiditypool.sol it’s going to wrongly return true for a personnel that should be false

See Tranche.sol#L80-L82)

// function checkTransferRestriction(address from, address to, uint256 value) public view returns (bool) {
//     return share.checkTransferRestriction(from, to, value);
// }

Also Tranche.sol#L35-L39

    modifier restricted(address from, address to, uint256 value) {
        uint8 restrictionCode = detectTransferRestriction(from, to, value);
        require(restrictionCode == restrictionManager.SUCCESS_CODE(), messageForTransferRestriction(restrictionCode));
        _;
    }

This function suggests that the system’s logic may rely on the detectTransferRestriction method in other parts of the ecosystem. Consequently, if the restriction manager’s logic is flawed, these other parts may also allow unauthorised transfers.

Foundry POC

Add this to the Tranche.t.sol contract

    function testTransferFromTokensFromBlacklistedAccountWorks(uint256 amount, address targetUser, uint256 validUntil) public {
        vm.assume(baseAssumptions(validUntil, targetUser));

        restrictionManager.updateMember(targetUser, validUntil);
        assertEq(restrictionManager.members(targetUser), validUntil);
        restrictionManager.updateMember(address(this), block.timestamp);
        assertEq(restrictionManager.members(address(this)), block.timestamp);

        token.mint(address(this), amount);
        vm.warp(block.timestamp + 1);

        token.transferFrom(address(this), targetUser, amount);
        assertEq(token.balanceOf(targetUser), amount);
    }

As seen even after address(this) stops being a member they could still transfer tokens to another user in as much as said user is still a member, which means a blacklisted user could easily do anything with their tokens all they need to do is to delegate to another member.

Recommended Mitigation Steps

RefactordetectTransferRestriction(), i.e modify the method to also validate the sending address (from). Ensure both from and to addresses are valid members before allowing transfers.

If this is contract’s intended logic then this information should be duly passed to the regulatory bodies that a user can’t really get blacklisted and more of user’s could be stopped from receiving tokens.

Assessed type

Context

hieronx (Centrifuge) commented:

This is a design decision. Transferring to a valid member is fine if that destination is still allowed to hold the tokens.

gzeon (judge) commented:

This is a design decision. Transferring to a valid member is fine if that destination is still allowed to hold the tokens.

This seems to contradict with Removing an investor from the memberlist in the Restriction Manager locks their tokens. This is expected behaviour. (See here)

hieronx (Centrifuge) commented:

Yes you’re right, that’s unfortunate wording. What I said above is correct, and the text in the README is incorrect. What was meant was that it locks their tranche tokens from being redeemed.

It is indeed fair to say though that, based on the README text, the above issue is valid.

hieronx (Centrifuge) commented:

Mitigated in https://github.com/centrifuge/liquidity-pools/pull/138


The original report as published on Code4rena, by Bauchibred. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The transfer restriction function only validates the recipient address and ignores the sender address.

Impact

A blacklisted user could still transfer tokens to any valid member, undermining the intended restriction.

What the attacker needed

Sender is blacklisted; recipient is a valid member

The fix

The issue was mitigated by a pull request that likely updates the restriction logic to check both sender and recipient.

How it was found

  1. Add the provided test to the Tranche.t.sol contract.
  2. The test sets up a target user and the test contract as members.
  3. The test mints tokens to the test contract.
  4. The test transfers tokens from the test contract to the target user.
  5. The test asserts that the target user received the tokens, even though the sender is no longer a member.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A blacklist is meant to stop certain users from moving their tokens. But the code only checks the person receiving tokens, not the person sending them. So a blocked user can still send tokens to someone else who is allowed, and the transfer goes through.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Bauchibred

View all

22 more disclosed reports, best first.

More from Centrifuge

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.