How to detect whether the ios app is pirated or not?
You can only install apps from itunes/the build in app-store.
Some apps are/claim to be installable through safari, but I wouldn't trust that.
If you have jailbroken your phone and installed an alternative app store, that is probably illegal, and will void your warranty (because apple won't let you jailbreak).
So if you have found a third party app store, it is probably fake, or illegal.