Ending a run of 12 without a win against the Atlas Lions in Monday's (AEDT) quarter-final, substitute Kahraba's 87th-minute goal secured a showdown with Burkina Faso in the last four.
The victory was scarcely deserved, with Essam El-Hadary twice relying on his crossbar to keep Morocco at bay, while Aziz Bouhaddouz missed a number of chances.
Egypt had been a threat only on the counter, but Munir had also made crucial saves before he could do nothing to prevent Kahraba's acrobatic winner.
Having failed to qualify for the last three tournaments, and won the previous three, Egypt is unbeaten in 23 games at the finals as it heads into the semi-final.
Amid a nervy opening, Ahmed Elmohamady's deep cross teed up a first shooting opportunity for Trezeguet, but the subsequent low thump was blocked well by Munir at his near post.
The Pharaohs could not build on that move, though, and, while both sides struggled to create chances before the break, an error almost allowed Morocco to open the scoring.
Ali Gabr swiped at a bobbling ball missed by his team-mates in front of goal, and a poor clearance sat up for Romain Saiss to head against the crossbar from close range.
Despite a slow first half, a pattern of play was quickly established after the interval, with Morocco attacking time and time again while Egypt played on the break.
Mohamed Salah tore through on goal and forced a strong one-handed save from Munir with a powerful strike, but the chances soon fell Morocco's way in quick succession.
First, El-Hadary dived out to divert Nabil Dirar's teasing centre, before Mbark Boussoufa's fine effort rattled the crossbar again from 25 yards, and, with the woodwork still shaking, Bouhaddouz rose to flick Hamza Mendyl's delivery just wide of the far post.
A Faycal Fajr cross was smuggled clear just as Bouhaddouz looked destined to score, and the St Pauli forward then headed narrowly wide as he met Dirar's looping ball.
For all the Moroccan pressure, though, Munir was again required to show his agility as Salah volleyed towards goal from Abdallah El Said's cute free-kick.
With three minutes remaining, Kahraba struck.
The substitute met a left-wing corner with his head and, when the ball sat up for him via a deflection, then volleyed across the line at the second attempt.