Two teenagers showed "incredibly dangerous" behaviour by playing on rail lines used by more than 100 trains a day, railway bosses said.
Officials at Network Rail released a picture of the two girls trespassing on railway tracks near Howden, East Yorkshire.
The rail firm said that with Christmas holidays arriving parents should speak to children about the dangers.
A spokeswoman said the girls' behaviour could have had "fatal consequences".
The two girls were pictured by Network Rail, close to Howden station where they were captured "messing around on the tracks".
A Network Rail spokesperson said: "Not only is this behaviour illegal, it is also incredibly dangerous; trains travel at high speeds, they have a long stopping distance and they cannot swerve out of the way.
"Being struck by a train at this speed would have devastating, life-changing and fatal consequences, as well as being incredibly distressing for the railway staff who would have to deal with the incident."
Officials from the firm said they would be visiting schools in the area in the new year to "highlight the dangers of messing around on and near the railway".
Spokeswoman Dawn Sweeting said: "We do a lot to highlight the dangers of messing around on and near the railway.
"We have a team of community safety managers who visit schools and engage with the community, as well as running campaigns, but we need everyone to do their bit too and take responsibility for their actions."