Morphine withdrawal leads to serious cognitive deficits in which dynorphins are directly involved. Recently, exercise has been shown to prevent and improve cognition dysfunction in a variety of ways. Meanwhile, exercise can regulate the endogenous opioid peptides including dynorphins. However, it remains unclear whether exercise influences cognitive dysfunction caused by morphine withdrawal via dynorphins. In the current study, we investigate the physiological mechanism of exercise prevention and improvement aganist cognition dysfunction caused by morphine withdrawal. Male, adult C57BL/6 mice were randomly divided into 5 groups : Saline control (WT), exercise (EXE), morphine withdrawl (MW), exercise + morphine withdrawl (EMW), morphine withdrawl + exercise (MWE). We established aerobic exercise prevention/improvement models, and conducted behavioral tests including Open field test (OFT), Temporal order memory test (TOM) and Y-maze. Through Western Blotting and immunofluorescence staining, we detected endogenous opioid peptides in hippocampus and mPFC. Compared with MW group, EMW group and MWE group showed the same performance as WT group in TOM and Y-maze, with correct object recognition and memory ability. In Western Blotting and immunofluorescence staining experiments, it indicated that EMW group reduced the expression of PDYN and its fluorescence intensity in hippocampus; MWE group reduced the expression of OPRK1 and its fluorescence intensity in mPFC. Our data suggest that aerobic exercise can both prevent and improve cognitive dysfunction caused by acute morphine withdrawal via respectively down-regulating PDYN in the hippocampus and down-regulating OPRK1 in the mPFC. They may become new targets for drugs development in the future.