The poorest students are borrowing the most money to pay their way through education, according to the National Union of Students.
NUS Scotland said students from the most disadvantaged areas take on the most debt.
Scottish university students do not pay tuition fees but receive bursaries and loans to pay living expenses.
The union was speaking as official statistics on student support were published.
The figures suggest more students are receiving bursaries and grants but the amount being borrowed is also increasing.
The figures from Scotland's Chief Statistician show an increase in both the number of students supported and the amount of support provided by the Student Awards Agency Scotland.
The report said there were 148,890 full-time undergraduate and postgraduate students in Scotland who received support last year - a slight increase ( 0.7% ) on 2017-18.
The support included any form of bursary, grant, fees or loans.
The average support provided for each full-time student was £6,010 - an increase from £5,970 in 2017-2018.
The total amount provided in non-repayable bursaries and grants for full-time students increased by 5.3%, from £76.3m in 2017-2018 to £80.3m in 2018-2019.
The total amount authorised in loans was £533.6m - an average of £5,300 a student. That was a 1% increase on the previous year.
However, the NUS said it was the poorest students who were taking out the biggest loans.
It says students from the most disadvantaged areas of Scotland are borrowing £5,800 a year against £4,960 for those from the least disadvantaged areas.
NUS Scotland president Liam McCabe said the figures "yet again highlight the precarious nature of being a disadvantaged student in Scotland".
He added: "Students from the poorest backgrounds are on course to finish their course with the most debt - an unacceptable, eye-watering £23,200 over four years.
"We are now three years on from the recommendations of the Student Support Review and the Scottish government's stated ambition of the equivalent of of a Real Living Wage for all students.
"With rising living and housing costs, we hope to see the Scottish government make good on this as spending plans are considered for the year ahead."