For the first two months after fleeing Aleppo, Yaser Mohammad slept outside in an olive grove. When it rained, he crawled under a lorry.

Home is now a leaking plastic tent on the Syrian side of the Turkish border. "We don't have bread. Fuel is very expensive. There is no electricity, no water," Mohammad said.

Another 6,500 Syrians are living in similarly dismal conditions, most having fled the war just down the road in Aleppo. Freezing temperatures and relentless rain over the past week have turned the Bab al-Salam refugee camp into a muddy swimming pool. "See for yourself: our tent contains centimetres of water. We can't sleep at night. We're exhausted. Everybody is exhausted. Our kids have lice."

Mohammad, his wife and six children are a tiny part of a much larger catastrophe now enveloping Syria. After 21 months of war, at least two million Syrians have been forced to leave their homes. Hundreds of thousands have fled abroad, where they live in dire conditions. But most are displaced inside Syria – camping in tents, sharing overcrowded rooms with relatives, renting private flats, or squatting in shivering school buildings.

This largely invisible exodus has pushed Syria's already strained infrastructure close to collapse. The cardinal problem is bread – Syria's most important food staple. There is not enough to go round; bread is disappearing. In the 21st century, and under the nose of the international community, a nation is sliding into starvation and medieval hunger.

In the northern town of Azaz, queues form outside bakeries in the dull sepia hours of early morning; by mid-afternoon hundreds of men, teenaged boys and women are still waiting in the cold outside. Over the past month the situation has got dramatically worse. "I've been waiting here since 4am. I'm still waiting," said Ahmed Yusuf, a nurse with the relief charity Doctors Without Borders. "I've skipped work to find bread. My son queued up yesterday. He spent so long outside he's now sick."

Some 20 miles (35km) from Aleppo, in the rebel-held town of al-Bab, the municipal bread factory had fallen silent. The factory's director, Osama Qasab, explained that his old supply chain had collapsed, leaving them without flour. It was the same situation everywhere. He said: "We don't have enough electricity, so we can't make bread.

"The FSA [Free Syrian Army] has promised us a generator. But...," he added, failing to complete his sentence.

In many areas, the electricity goes on for a few meagre minutes each evening before vanishing again. In the bitter winter, families sit in the cold and dark.

If this were not bad enough, there is overwhelming evidence that the military forces of Syria's President Bashar al-Assad have deliberately targeted bakeries, in what appears to be official policy to starve rebel areas into submission. (It has also hit field hospitals, schools and civilian areas.) The al-Bab factory has been targeted three times; the last time a rocket injured six bakery workers. "We wanted freedom and look what happened. The regime cut everything," Qasab said.

A smaller bakery nearby was still operational: 500 people were waiting outside; each had a number scrawled in ink on their palms. It was unclear when, if at all, bread might emerge, like a minor miracle, from a small factory hatch.

This week, as desperation rises, the first food demonstrations have broken out in rural areas; some have resorted to trying to bake bread at home, with Syria returning to its Ottoman past. The FSA, in effect the government now in much of Syria's countryside, admits that there is little it can do.

In opposition areas, some food is still available. And, to a superficial degree, life is normal. There are markets selling vegetables, restaurants even. But the prices for most Syrians have become fantastical, as if fixed by a demented and mocking god.

Fuel oil, or mazout, which was used by Syrians to heat their homes cheaply before the fighting began, has gone up 900% from 20 Syrian pounds (17p) a litre to 200. A cylinder of cooking gas costs 3,800 Syrian pounds (£33) – a fortune to most people, especially at a time that spiralling inflation has wiped out savings.

Some blame the west for doing too little to assuage what is undoubtedly a major humanitarian disaster. Ahmed Hadad, logistics officer for a Syrian charity, NOR, said he had received just one recent donation of 200 tonnes of flour. He needs 600 tonnes a day just to supply local bakeries – and 1m tonnes a day to feed northern Syria. "It isn't enough. Why is nobody helping? Where is the UN?" he asked, adding bitterly: "People in the west are concerned about dogs and cats. But they don't seem to care about Syrians who are starving here."

The 200 tonnes were sitting in a warehouse at the Turkish border: the agency did not have enough money to pay drivers to deliver it to Aleppo. The road is so dangerous, strafed by regime jets and helicopters, that drivers are demanding exorbitant sums to go there, he said.

The situation is better in camps outside Syria – in Iraq, Jordan, and Turkey, where international aid agencies such as Save the Children can operate. An estimated 400,000 Syrians have left the country to sit out the war as refugees; since the anti-Assad uprising began in March 2011, at least 40,000 have been killed.

But leaving Syria for neighbouring countries has grown increasingly tricky, despite the army of smugglers willing to take refugees across muddy fields and past Turkish checkpoints. "We tried to cross into Turkey. We were turned back," said Umm Anis, a widow living in a soggy tent with her daughter, son-in-law and grandchildren. "We pray to God to bring down this regime so we can go home."

In the Turkish border town of Kilis, officials are not accepting more Syrian refugees – the town is full. Some 21,000 Syrians are already living in a sprawling refugee camp, sleeping in comparatively luxurious shipping containers.

Those stuck in Syria have learned to improvise. On the Bab al-Salam camp side of the border, families have hung washing between olive trees; children hawk biscuits and cigarettes; families boil water over makeshift fires lit with scavenged wood. The camp authorities serve two meals a day: a breakfast of bread and jam; and a late afternoon meal: a plastic container of pasta.

In the unlikely event that Syria's war were to end tomorrow, many of those displaced have nothing to go back to. Abu Ahmed, a 42-year-old driver from Aleppo, said he had fled his house in the suburb of Hanano on 27 July, when the regime started bombing and shelling indiscriminately. "My house has been completely looted," he said. The regime army followed by the shabiha – Assad's feared paramilitaries – had swept through the area 10 weeks ago and taken absolutely everything, he said. He added: "I've been in a tent for the past two months."

To some extent, those in camps are the more fortunate. A few kilometres away, outside the town of Azaz, 60-year-old Hamida is living in a concrete hovel with her two grown-up daughters. She fled Azaz four months ago to escape fighting between the FSA and regime forces; a shell demolished her house. (After a furious battle the rebels took control of Azaz and the nearby border crossing. The town is relatively calm: small boys play amid the wreckage of government tanks and masonry, swinging on gun barrels or jumping in and out of turrets.)

One of Hamida's daughters, Zakiya, was outside coaxing a flame from a brazier; inside it was cold, damp, and dark. The women had no electricity and no roof – merely a soggy fabric tarpaulin stretched between two walls. There is scant medicine here – and no money with which to buy it; Zakiya had a severe cough. Some aid is getting through: a local FSA commander, Abu Ibrahim, dropped by with a couple of blankets for the women. But it is not enough. Hamida said her infirm husband was living with her son in Azaz: three adults and five children sharing one room.

On the outskirts of town, Hussein Ibrahim was hitching a lift back to his village of Soran. He said he had spent the day in Azaz in the hope of finding bread. "The first factory had broken down. They said the machines weren't working properly. By the time I reached the other factory there was a big crowd." He left without any bread. What would he eat? "I don't know," he said.

• This article was amended on 18 December 2012. The original said fuel oil had gone up 1,000% from 20 Syrian pounds to 200. That has been corrected to 900%.