This study aims to examine the mediating role of peer attachment between affective school environments and the problematic behaviors of children using data from the Panel Study on Korean Children 10th wave (2017). Descriptive statistics, reliability analysis, correlation analysis, multiple regression analysis, Sobel test, and bootstrapping versification were performed using SPSS 28.0 and Process Macro 28.0. The results indicate that controlled and rigid school environments were negatively associated with peer attachment and positively associated with both internal and external behavior problems. Furthermore, peer attachment was negatively associated with both internal and external behavioral problems. Peer attachment completely mediated the link between affective school environments and internal behavioral problems, and partially mediated the link between affective school environments and external behavioral problems. These results show the important role of supportive and democratic school environments regarding peer attachment.