EVERY MORNING, KIM Casipong strolls past barbed wire, six dogs, and a watchman in order to get to her job in a pink apartment building high above the slums in Lapu-Lapu City, Philippines. She is a pretty, milk-skinned, 17-year-old girl who loves the movie Frozen and whose favorite pastime is singing karaoke. She is on her way to do her part in bringing down Facebook.

Casipong huffs to the third floor, opens a door decorated with a crucifix, and greets her co-workers. The curtains are drawn, and the artificial moonlight of computer screens illuminates the room. Eight workers sit in two rows, their tools arranged on their desks: a computer, a minaret of cellphone SIM cards, and an old cellphone. Tens of thousands of additional SIM cards are taped into bricks and stored under chairs, on top of computers, and in old instant-noodle boxes around the room.

Richard Braggs, Casipong's boss, sits at a desk positioned behind his employees, occasionally glancing up from his double monitor to survey their screens. Even in the gloom, he wears Ray-Ban sunglasses to shield his eyes from the glare of his computer. ("Richard Braggs" is the alias he uses for business purposes.)

Casipong inserts earbuds, queues up dance music, and checks her clients' instructions. Their specifications are often quite pointed. A São Paulo gym might request 75 female Brazilian fitness fanatics, or a bar in San Francisco's Castro district might want 1,000 local gay men. Her current order is the most common: fake Facebook profiles of beautiful American women between the ages of 20 and 30. Once a client has received the accounts, he will probably use them to sell Facebook likes to customers looking for an illicit social media boost.

Most of the accounts Casipong creates are sold to these digital middlemen — "click farms" as they have come to be known. Just as fast as Silicon Valley conjures something valuable from digital ephemera, click farms seek ways to create counterfeits. Just Google "buy Facebook likes" and you'll see how easy it is to purchase black-market influence on the internet: 1,000 Facebook likes for $29.99; 1,000 Twitter followers for $12; or any other type of fake social media credential, from YouTube views to Pinterest followers to SoundCloud plays. Social media is now the engine of the internet, and that engine is running on some pretty suspect fuel.

Casipong plays her role in hijacking the currencies of social media — Facebook likes, Twitter followers — by performing the same routine over and over again. She starts by entering the client's specifications into the website Fake Name Generator, which returns a sociologically realistic identity: Ashley Nivens, 21, from Nashville, Tennessee, now a student at New York University who works part-time at American Apparel. Casipong then creates an email account. The email address forms the foundation of Ashley Nivens' Facebook account, which is fleshed out with a profile picture from photos that Braggs' workers have scraped from dating sites. The whole time, a proxy server makes it seem as though Casipong is accessing the internet from Manhattan, and software disables the cookies that Facebook uses to track suspicious activity.

Next, Casipong inserts a SIM card into a Nokia cellphone, a pre–touch screen antique that's been used so much, the digits on its keypad have worn away. Once the phone is live, she types its number into Nivens' Facebook profile and waits for a verification code to arrive via text message. She enters the code into Facebook and — voilà! — Ashley Nivens is, according to Facebook's security algorithms, a real person. The whole process takes about three minutes.

Casipong sometimes wonders what happens to profiles like these once she turns them over to the clients. But it's just a job. Once she earns a degree in web design, she hopes to join the Philippine diaspora and find work in Australia, New Zealand, or the United States.

When Casipong stands up at 6 p.m., a night-shift worker is waiting to take her chair.

ONCE, IF YOU wanted to make money scamming people on the internet, you used email. For two years, Braggs made his living spamming half a billion email addresses, hawking blueprints for a mythical perpetual energy machine or e-books that explained the secret to winning the lottery. Filipinos even invented a term for this kind of work, "onlining," and for about a decade it was a semi-honorable career path in Cebu City, the metropolitan area that encompasses Lapu-Lapu City and is one of the foremost business-outsourcing centers in the world.

But from 2010 to 2012, teams of internet security researchers and law enforcement officials dismantled several spambot networks across the world. These efforts, combined with the improved defenses of email hosts, effectively disabled many onliners in Cebu City. They had to look for new ways to make money.

Meanwhile, social media's takeover of the internet had been swift and dramatic. Between 2005 and 2012, the percentage of internet-using American adults on a social media platform mushroomed from 8 to 70 percent. In 2005, Facebook had 5.5 million users; at the end of 2014, it claimed 1.4 billion active monthly users — a little less than half of all people with internet access.

In 2009, Facebook introduced the "like" button, which quickly became a way for people to celebrate an engagement or the birth of a baby, but also for brands to get people to endorse their products. Companies loved social media for the ostensible humanity it lent them; sales leads that came through social media, studies showed, had a much higher chance of converting into actual purchases. Google's and Bing's algorithms take social media into account, so large followings could also improve a company's position in search-engine rankings, where appearing even one slot higher can mean significant additional revenue.

Celebrities — and more minor personalities, like bloggers trying to get endorsement deals — have increasingly found their value measured in Facebook fans and Twitter followers, and the payments they receive proportionate to their social media clout. Khloé Kardashian reportedly earns around $13,000 every time she tweets things like, "Want to know how Old Navy makes your butt look scary good?" to her 14.5 million followers. Politicians desire large followings for obvious reasons. Even ordinary people have discovered perks to having an extensive social media presence: Some employers, for instance, now require social media savvy for jobs in marketing, PR, or tech.

To help companies, celebrities, and everyday people boost their social media standing, onliners set up internet stores — click farms — where customers can buy social media influence. Click farms can be found across the globe, but are most commonly based in the developing world, in countries like India, Indonesia, Bangladesh, and the Philippines. Most are run by smaller teams that manage software to give digital life to accounts like "Ashley Nivens."

Researchers estimate that the market for fake Twitter followers was worth between $40 million and $360 million in 2013, and that the market for Facebook spam was worth $87 million to $390 million. International corporations like Pepsi, Coca-Cola, Mercedes-Benz, and Louis Vuitton have all been accused of employing click farms, and celebrities like 50 Cent, Paris Hilton, and LeAnn Rimes have been suspected of buying fake followers. During his 2012 presidential campaign, Mitt Romney gained more than 100,000 Twitter followers in a single weekend, despite averaging only 4,000 new followers a day previously. (His campaign denied having bought any fakes.) One Indonesian click farmer told me that he had funneled 2 million Facebook likes to a candidate in his nation's hotly contested July 2014 presidential election.

Click farms jeopardize the existential foundation of social media — the idea that the interactions on it are between real people. Just as importantly, they undermine the assumption that advertisers can use the medium to efficiently reach real people who will shell out real money. More than $16 billion was spent worldwide on social media advertising in 2014; this money is the primary revenue for social media companies. But if social media is no longer made up of real people, what is it?

BRAGGS GOT INTO onlining in 2011 after a friend who had struck it rich spamming gave him the software to start his own operation. When Braggs' email spam business failed in 2012, he opened his own click farm, manually forging thousands of Facebook accounts and selling likes from them, incrementally hiring workers as his business grew.

By July 2013, he was making phone-verified accounts — or PVAs — full time. He hired 17 employees, including Casipong, and established round-the-clock shifts so his farm never went dark. Casipong guesses that she makes over 100 Facebook PVAs a day. Other employees average more than 150. Braggs sells PVAs for 70 cents; "premium" PVAs — accounts that are fleshed out with more than bare-bones biographical details — can be bought for $1.50.

Since his business began, Braggs has expanded into Yahoo, Gmail, and Twitter PVAs, and his customers have used the fake accounts in all sorts of scams. On the dating site Tinder, for example, Braggs said he believes seductive women solicit male users for pay-to-access porn sites. His biggest order, he told me, was for Chinese hackers trying to fleece the digital payment exchange Stellar; he hired every freelance worker he could find, but he was still only able to fulfill a small portion of it.

But Braggs' farm feels more like a startup than a developing-world sweatshop. Most of his employees are young IT university graduates infused with the excitement of beating the system. There is an office puppy named Hacker, and Braggs pays for a cook to prepare lunch for the employees every day. Casipong earns about $215 a month, significantly more than the local minimum wage for a domestic helper, which can be as low as $34 a month.

What Braggs and click-farm managers are doing is not illegal in the Philippines. Facebook's terms of service are not international law. "Click farming raises serious consumer protection questions," said Ian Ayres, a professor at Yale's law and business schools. But the actual law is less explicit. And Braggs has his own business ethics: He's not hacking anyone's bank account, only offering a service that people are clamoring to pay for. And in the process, he's providing for himself, his family, and his countrymen.

THIS FEBRUARY, FACEBOOK stated that about 7 percent of its then 1.4 billion accounts were fake or duplicate, and that up to 28 million were "undesirable" — used for activities like spamming. In August 2014, Twitter disclosed in filings with the Securities and Exchange Commission that 23 million — or 8.5 percent — of its 270 million accounts were automated.

It is in the interest of Facebook and other platforms to downplay the severity of the fake-accounts problem. In 2014, more than 90 percent of Facebook's $12.5 billion in revenue and about 90 percent of Twitter's $1.4 billion in revenue came from advertising. If researchers are correct that advertising on social media leads to a high percentage of fake likes and fans and followers, the entire business model could be called into question by advertisers.

It seems impossible that Facebook, with its army of coders and multibillion-dollar war chest, won't eventually crush Braggs and his operation. The company knows his real name. It barrages his inboxes with cease-and-desist orders. But he's hopeful. "Every system is made by humans," Braggs told me, "so there is always a way to beat it."

Excerpted from an article that originally appeared in The New Republic. Reprinted with permission.