A university student allegedly broke into a school office four times in order to steal passwords and change his grades. On his fourth-trip, he found much more to worry about than his school performance.

A Gloucester County grand jury has indicted Rowan University senior Kaustubh M. Shroff, 22, of Deptford Township, on charges including burglary, tampering with records, and computer and identity crimes.

Shroff, a biological sciences major, allegedly broke into the registrar's office in Savitz Hall in Glassboro between December of last year and Jan. 11 with two goals.

First, he plugged a flash drive containing keylogger software into a computer. A keylogger records keystrokes made by computer users and was used to steal staff login credentials, prosecutors allege.

He then returned to the office and used those passwords to access his professors' files and change his grades in several classes, including advanced cell biology, organic chemistry, invertebrate zoology and philosophy of science.

During the Jan. 11 break-in -- he used a credit card to foil a door lock, according to his criminal complaint -- he was caught in the act.

He confessed to his actions, according to the complaint.

Shroff, described as a transfer student, was expelled from the university, officials confirmed.

His alleged tampering didn't involve remotely hacking the school's computer network. The keylogger software wasn't installed on the computer system itself, just the flash drive, a Rowan spokesman explained.

As a result, the student had to return multiple times to retrieve the stolen logins and to change his grades on one of the office computers, according to the complaint. The flash drive was apparently plugged into computers in a spot not easily seen by staff, the spokesman said.

Shroff will appear in Superior Court next week for a post-indictment arraignment on the charges. His attorney did not return a call seeking comment.

Matt Gray may be reached at mgray@njadvancemedia.com. Follow him on Twitter @MattGraySJT. Find the South Jersey Times on Facebook. Have a tip? Tell us: nj.com/tips.