Can I write my PhD thesis based on another student's paper if I'm a co-author?
"Can I write my PhD thesis based on another student's paper if I'm a co-author?"

I feel a difference between the question title and the question content. It boils down, to me, to "were you a notably active contributor to this paper"?

If the answer is yes, and you take care about rephrasing published text, re-drawing figures, you can reuse the results. A thesis should be personal, and show your personal contributions. A PhD thesis based on only one paper is not uncommon in mathematics, yielding short theses. In other domains, you can expect to write one or two chapters for a published paper, by extending results, adding experiments. Not a whole thesis.

If the other student's contribution is significant enough, he should be acknowledged in the chapter introduction for instance: "this chapter is based on a joint work..."

If the answer is no, I am afraid it could be a case of plagiarism, and loose ethical behavior.