A hidden passenger faces the risk of imprisonment, as it is illegal in most jurisdictions to embark on aircraft, boats or trains as stowaways. Airports, sea ports and train stations are typically marked as "No Trespassing" or "Private Property" zones to anyone but customers and employees.
Here is an exempale of u.s law
"Occasionally, you may encounter an alien who claims to be a stowaway, but cannot or will not provide information concerning the name of the vessel of arrival. Prior to April 1, 1997, such aliens could be handled in the same way as any other EWI [entered without inspection] case and placed into removal proceedings. The [Illegal Immigration Reform and Immigrant Responsibility Act], however, directs that stowaways, regardless of when encountered, are to be removed without a hearing.citing section 235(a)(2) of the Act as the authority for the action."
The law is explicit: Illegal alien stowaways are to be detained and deported without hearings.