Precise quantification of aflatoxins in complex food matrices remains challenging because of substantial matrix interference. In this work, an aptamer-grafted amino-functionalized covalent organic framework (Apt@NH2-COF) was developed through covalent immobilization of aptamers using a heterobifunctional crosslinker. The introduced aptamers significantly enhanced analyte-specific molecular recognition, enabling highly selective adsorption of aflatoxins B1, B2, G1, and G2, with corresponding adsorption capacities of 23.05, 15.92, 21.50, and 16.39 mg g-1, respectively. Experimental investigations combined with density functional theory calculations and molecular docking revealed that adsorption was governed by the synergistic effects of electron donor-acceptor hydrogen bonding, π-π stacking, and hydrophobic interactions, with the immobilized aptamers providing analyte-specific recognition and the COF scaffold ensuring high-capacity enrichment. When employed as the solid-phase extraction sorbent coupled with UPLC-MS/MS, the proposed method enabled simultaneous determination of four aflatoxins with wide linear ranges (0.02-10.0 ng g-1), low limits of detection (0.002-0.022 ng g-1), satisfactory recoveries (80.8%-112.5%), and good reusability over 12 adsorption-desorption cycles. Overall, the proposed Apt@NH2-COF provides an effective affinity sorbent for selective aflatoxin enrichment and offers a feasible strategy for improving sample preparation in complex food matrices.