A tenant in Germany generally may not sublet without the landlord's consent. They are usually entitled to ask for it — a legitimate reason, such as going away for a while or needing to share the rent, is normally enough — but the asking is the part that gets skipped, because it is a conversation nobody wants to have.
For you, this is the most useful question you can ask and almost nobody asks it: does your landlord know? If the answer is yes and there is something in writing, your arrangement is about as solid as a sublet gets. If the answer is a pause, you are renting into a situation that the main tenant has an interest in keeping quiet, which affects everything downstream — whether you can register your address, whether you can have post delivered in your own name, and what happens if a neighbour mentions you to the Hausverwaltung.
Ask it lightly and early, in the first message, along with whether you can register there. Framed as “just checking I can do my Anmeldung” it is a completely normal question and a good host will answer it in a sentence. An evasive answer is information.
It is not usually a dealbreaker. Plenty of perfectly happy Berlin sublets are technically unpermitted, and for four weeks it may genuinely not matter. For six months, with a job that needs your tax ID, it does.