TheBro21's comment applies only if it's a KNOX enabled device. For most Android devices, when you boot into downloading mode it will read a few lines in "SYSTEM STATUS: custom" or "Custom Binary Download YES (and the number of time here, if it hasn't be reset with triangle away)". If in bootloader mode it says Unlock state: true
, it might be that the ROM is custom, but then again it may have been done by a stock flash.
You can also go into the settings and about and look at the system status, ROM, kernel, or base-band and if it has a weird name, google it, it's probably a custom ROM or kernel, if not, it probably isn't or close enough you'd never notice.
If you really are concerned and want a fresh device on official firmware, google how to flash your device with Odin, than download the latest stock firmware.
KNOX warranty void: x
on the top. Values are either 0 or 1 dependent on if it is tampered or not. Doing OTA updates SHOULD also switch to normal android OS, unless the hacker managed to make OTA updates download from his repository