The single best source of info on how and where to lube the M4/AR platform is the Colt owner's manual.
Lube is only required in certain places and it can be lubed generously in those places. However, there are certain places that should NEVER receive lube - EVER.
The technical data package (TDP) on the M4 developed by Colt's over the decades of its military experience has made the M4 an exceedingly reliable rifle. Although all sorts of loud mouths say that the direct gas impingement system is dirty (it is), and that it will cause your rifle to malfunction (it might, maybe, after 10 THOUSAND rounds or so - maybe), for our purposes here, the gas piston system has no real advantage and at least one serious disadvantage - the rocking effect to the bolt which Colt has virtually eliminated in its piston rifle with its ALP (articulating link piston).
I have one friend who never cleans his shooters until they malfunction, and I was along with him and happened to be shooting his M4 when it finally choked - at just over 15,000 rounds. All he did was lube very generously in all the right places during that 15,000 round run.
Hickok 45 has an excellent video demonstrating his cleaning method for an AR or M4 type rifle. It follows the Colt method pretty closely as to locations for lube, etc.
Of course, Larry Vickers ran that episode where he simply dunked the entire rifle in a vat of Mobil One or some other type of motor oil. The rifle worked fine, but one warning about that - oil clearly went places it shouldn't in that demonstration, and they were trying to show that too much lube would not cause the rifle to gunk up. On the other hand, the gas system and tube should be as dry as a bone under ideal conditions.