This is an easy example with automatic addition to table of contents, nearly from the manual. As you can see you will also be able to mix ordinary sections with tcolorboxed sections.
Just to explain why your titlesec
approach is very hard to implement: LaTeX (as opposed to ConTeXt) does not know the point a section really ends, so it cannot determine where the body of the environment should end. That's why this answer uses an explicit environment to work around this issue.
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\newtcolorbox[auto counter, use counter=section, list type=section, list inside=toc]{sectionbox}[1]{colback=red!5!white, colframe=red!75!black, fonttitle=\bfseries, title={\thetcbcounter\ #1}, list entry={\thetcbcounter\quad #1}, breakable}
\begin{document}
\tableofcontents
\begin{sectionbox}{Test}
Test
\end{sectionbox}
\section{Test}
\begin{sectionbox}{Test}
Test
\end{sectionbox}
\end{document}