Contrast Enhancement (CE) detection in the presence of laundering attacks, i.e. common processing operators applied with the goal to erase the traces the CE detector looks for, is a challenging task. JPEG compression is one of the most harmful laundering attacks, which has been proven to deceive most CE detectors proposed so far. In this paper, we present a system that is able to detect contrast enhancement by means of adaptive histogram equalization in the presence of JPEG compression, by training a JPEG-aware SVM detector based on color SPAM features, i.e., an SVM detector trained on contrast-enhanced-then-JPEG-compressed images. Experimental results show that the detector works well only if the Quality Factor (QF) used during training matches the QF used to compress the images under test. To cope with this problem in cases where the QF cannot be extracted from the image header, we use a QF estimation step based on the idempotency properties of JPEG compression. Experimental results show good performance under a wide range of QFs.