# LienToken._payment function increases users debt

LienToken._payment folds accrued interest into principal on partial repayment, compounding interest despite docs promising simple non-compounding interest.

- Payout: Contest reward
- Severity: medium
- Program: Astaria
- Credited: rvierdiiev
- Disclosed: 2023-05-22
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-01-astaria-findings/issues/96
- Library page: https://bugbountylibrary.com/r/c4%3A2023-01-astaria%3AM-31
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error

**Target:** LienToken.sol _payment / makePayment
**Root cause:** On partial repayment, _payment sets stack.point.amount = owed (principal + accrued interest), so future interest is computed on the inflated principal, compounding interest contrary to documented simple interest.
**Steps:**
1. Borrower opens a lien with a nonzero rate.
2. Time passes so interest accrues; owed = principal + interest.
3. Borrower calls makePayment with amount < owed.
4. In _payment, stack.point.amount is set to owed (line 826), then reduced by amount.
5. Remaining principal now includes prior interest; next _getInterest computes interest on this larger amount, compounding.
**How found:** Code reading of _payment: noticed stack.point.amount is overwritten with owed (which includes interest) rather than tracking accrued interest separately, then compared against the docs' simple-interest claim.
**Insight:** When a lending contract stores principal and interest in one field, check whether partial repayments fold interest into principal; compare against documented interest model to prove broken functionality.
