Facebook is being investigated for allegedly sharing its users' data with dozens of tech companies without their knowledge.

Prosecutors are conducting a criminal investigation into data deals struck by the social media giant with some of the world’s largest technology companies amid intense scrutiny of the firm in recent years.

A New York grand jury has subpoenaed records from two smartphone makers involved in the partnerships, anonymous sources told The New York Times.

Facebook is being investigated for allegedly sharing its users' data with dozens of tech companies without their knowledge. CEO Mark Zuckerberg (pictured) has faced questioning over how user data is handled

It is understood that data shared without users' knowledge included friends' names, genders and birth dates.

Facebook claimed in June that it provided dozens of tech companies with special access to user data after publicly saying it restricted such access in 2015.

The New York Times reported that Amazon, Apple, Microsoft and Sony, cut data sharing deals with the world’s dominant social media platform.

However, Facebook continued sharing information with 61 hardware and software makers after it said it discontinued the practice in May 2015.

The agreements let the companies see users’ friends, contact information and other data, sometimes without consent.

Facebook has phased out most of the partnerships over the past two years.

A spokesman for the social network said: 'We are cooperating with investigators and take those probes seriously.

'We’ve provided public testimony, answered questions and pledged that we will continue to do so.'

Facebook claimed in June that it provided dozens of tech companies with special access to user data after publicly saying it restricted such access in 2015

Facebook is facing a slew of lawsuits and regulatory inquiries over its privacy practices, including ongoing investigations by the U.S. Federal Trade Commission, the Securities and Exchange Commission and two state agencies in New York

It is not known when the grand jury inquiry, overseen by prosecutors with the United States attorney’s office for the Eastern District of New York, began or exactly what it is focusing on.

Facebook is facing a slew of lawsuits and regulatory inquiries over its privacy practices, including ongoing investigations by the U.S. Federal Trade Commission, the Securities and Exchange Commission and two state agencies in New York.

In addition to looking at the data deals, the probes focus on disclosures that the company shared the user data of 87 million people with Cambridge Analytica, a British consulting firm that worked with U.S. President Donald Trump's campaign.

Since then, Facebook CEO Marc Zuckerberg has testified in front of Congress and the European Parliament to answer questions about Facebook's handling of user data.

In April Zuckerberg took questions for nearly five hours in a Senate hearing without making any further promises to support new legislation or change how the social network does business, foiling attempts by senators to pin him down.

A mural decorates one of the many open space work areas at the Facebook headquarters in Menlo Park, California

Mark Zuckerberg (left) and his wife Priscilla Chan (right) attend the 2019 Breakthrough Prize at NASA Ames Research Center last November

Zuckerberg faced broad concerns from members of Congress about how Facebook shares user data.

'How can consumers have control over their data when Facebook does not have control over the data?' asked Representative Frank Pallone of New Jersey, the ranking Democrat on the Energy and Commerce committee.

The latest estimate of affected users is up to 87 million.

Patience with the social network had already worn thin among users, advertisers and investors after the company said last year that Russia used Facebook for years to try to sway U.S. politics, an allegation Moscow denies.

Lawmakers have sought assurances that Facebook can effectively police itself, and few came away from the hearing expressing confidence in the social network.

'I don't want to vote to have to regulate Facebook, but by God, I will,' Republican Senator John Kennedy told Zuckerberg on Tuesday. 'A lot of that depends on you.'

Facebook Chief Operating Officer Sheryl Sandberg has taken hits to her reputation as she continues to be the frontwoman for Facebook's excuses over its privacy shortfalls

Zuckerberg deflected requests to support specific legislation. Pressed repeatedly last year by Democratic Sen. Ed Markey to endorse a proposed law that would require companies to get people's permission before sharing personal information, Zuckerberg agreed to further talks.

'In principle, I think that makes sense, and the details matter, and I look forward to having our team work with you on fleshing that out,' Zuckerberg said.

Facebook has defended the data-sharing deals, first reported in December, saying none of the partnerships gave companies access to information without people's permission.

A spokesman for the United States attorney's office for the Eastern District of New York, which The New York Times reported is overseeing the inquiry, said he could not confirm or deny the probe.

Cambridge Analytica's former CEO Alexander Nix arrives to give evidence to Parliament's Digital, Culture, Media and Sport Committee at Portcullis House in central London last year

Facebook Chief Operating Officer Sheryl Sandberg has taken hits to her reputation as she continues to be the frontwoman for Facebook's excuses over its privacy shortfalls.

It emerged last month that the company took advantage of Apple's enterprise developer certificate, which enables companies to distribute apps internally, to create an app that paid users as young as 13 to share their phone activity with Facebook.

Among the data collected from teens by the app was all of their phone and web activity, information on apps they installed, when they used them and what they did on them.

'I want to be clear what this is. This is a Facebook research app,' Sandberg told CNBC.

'It's completely opt-in. There is a rigorous consent flow and people are compensated.

'The important thing is that people involved in that research project knew they were involved and consented.'