Thanks to The Omen, Daniel Shaw escaped from prison. He captured Sarah and took over Castle. He demanded Chuck retrieve a device he needed in order to use The Omen properly.
Chuck found the device, thanks to the help of Beckman, and used Jeff and Lester to figure out what it was going to be used for. Once he learned Shaw was going to use it to download the intersect 3.0 into his brain, Chuck re-routed it to remove the intersect entirely.
After Ellie helped Chuck defeat Shaw in a fist fight, they sent him away to prison again. Beckman then gave everyone at Carmichael Industries the opportunity to join the CIA.