Let $V$ be the affine subspace generated by $X$. Let $d$ be the dimension of $V$. Now, we have the inclusions
$$\mathring X\subset X \subset \bar X$$
where $\mathring X$ is the relative interior of $X$ ( that is, the interior of $X$ inside $V$). The boundary of $X$ has Hausdorff dimension at most $d-1$ ( got an answer about it on this site). So we can restrict to the problem $f \colon \mathring X\to \mathbb{R}$, that is, a function defined on an open convex set. From here we can reduce to the case $X=\mathbb{R}^d$.
$\bf{Added:}$ Let's see how the reduction to $\mathbb{R}^d$ works: consider $f\colon X \to \mathbb{R}$ convex, where $X\subset \mathbb{R}^d$ convex and open. Recall that for every $x \in X$ the graph of $f$ has a linear support at $x$, that is, there exists an affine map $L_x\colon \mathbb{R}^d\to \mathbb{R}$ such that $L_x(x) = x$ and $L_x(x') \le f(x')$ for all $x'\in X$. We can see that $f$ is the supremum of the family $(L_x)_{x\in X}$. Note that each $L_x$ is defined on the whole $\mathbb{R}^d$. Therefore, we can define $L\colon \mathbb{R}^d$ as
$$F= \sup_{x\in X} L_x$$
From the above, $F_{\mid X}= f$. Moreover, $F$ is convex, as a supremum of a family of convex functions ( in fact affine functions). Therefore, $F$ is an extension of $f$ to the whole $\mathbb{R}^d$.
Obs: It may be that $F$ has value $+ \infty$ at some points. Then we can extend in this way the restriction of $f$ to a smaller open set.
In this way, we can use the previous result about convex functions on the whole $\mathbb{R}^d$.