Pakistan were bowled out for 240 on the brink of stumps with Starc finishing with four wickets.
Cummins ended Shafiq's resistance at the other end for 76 as Pakistan were slipping.
Starc was on a hat-trick afte Shaheen Afridi departed next ball. He didn't get one eventually.
Yasir did well to hold his end, until he was undone by a Starc yorker with the new ball.
Shafiq got to a fifty thereafter and added 84 runs with Yasir to keep Australia at bay.
Rizwan was given out in a controversial decision. No part of Pat Cummins's foot was found behind the line. Instead of it being adjudged a no-ball he was given out.
Asad Shafiq then staged two resilient stands - first with Mohammad Rizwan who counterattacked the bowlers. And then with Yasir Shah.
Wickets fell in a heap as Pakistan were reduced to 94/5.
One brought two for Australia as the openers were sent back in successive overs.
It was Pat Cummins once again who gave Australia the breakthrough right after Lunch, getting Masood after a hostile spell.
Shan Masood and Azhar Ali added 75 for the opening wicket as Pakistan were the first visiting team since 2001 that didn't lose a wicket in the opening session at the Gabba.
Naseem Shah became the ninth-youngest debutant in Test cricket after being named in Pakistan's XI.