Contrast enhancement (CE) forensics has always been ofconcern to image forensics community. It can provide aneffective tool for recovering image history and identifyingtampered images. Although several CE forensic algorithmshave been proposed, their robustness against some processingis still unsatisfactory, such as JPEG compression and anti-forensic attacks. In order to attenuate such deficiency, inthis paper we first present a discriminability analysis of CEforensics in pixel and gray level histogram domains. Then, insuch two domains, two end-to-end methods based on convo-lutional neural networks (P-CNN, H-CNN) are proposed toachieve robust CE forensics against pre-JPEG compressionand anti-forensics attacks. Experimental results show that theproposed methods achieve much better performance than thestate-of-the-art schemes for CE detection in the case of noother operation and comparable performance when pre-JPEGcompression and anti-foresics attacks is used.